tree: 3a2f9bc43098cc70874c6f4001e18df545bef055 [path history] [tgz]
  1. benchmarks/
  2. datatransfer/
  3. storage/
  4. .repo-metadata.json
  5. bigquery.go
  6. bigquery.replay
  7. CHANGES.md
  8. copy.go
  9. copy_test.go
  10. dataset.go
  11. dataset_test.go
  12. doc.go
  13. error.go
  14. error_test.go
  15. examples_test.go
  16. external.go
  17. external_test.go
  18. extract.go
  19. extract_test.go
  20. file.go
  21. file_test.go
  22. gcs.go
  23. go.mod
  24. go.sum
  25. go_mod_tidy_hack.go
  26. inserter.go
  27. inserter_test.go
  28. integration_test.go
  29. iterator.go
  30. iterator_test.go
  31. job.go
  32. job_test.go
  33. load.go
  34. load_test.go
  35. model.go
  36. model_test.go
  37. nulls.go
  38. nulls_test.go
  39. oc_test.go
  40. params.go
  41. params_test.go
  42. query.go
  43. query_test.go
  44. random.go
  45. read_test.go
  46. README.md
  47. routine.go
  48. routine_test.go
  49. schema.go
  50. schema_test.go
  51. standardsql.go
  52. standardsql_test.go
  53. table.go
  54. table_test.go
  55. value.go
  56. value_test.go
bigquery/README.md

BigQuery GoDoc

Example Usage

First create a bigquery.Client to use throughout your application: [snip]:# (bq-1)

c, err := bigquery.NewClient(ctx, "my-project-ID")
if err != nil {
	// TODO: Handle error.
}

Then use that client to interact with the API: [snip]:# (bq-2)

// Construct a query.
q := c.Query(`
    SELECT year, SUM(number)
    FROM [bigquery-public-data:usa_names.usa_1910_2013]
    WHERE name = "William"
    GROUP BY year
    ORDER BY year
`)
// Execute the query.
it, err := q.Read(ctx)
if err != nil {
	// TODO: Handle error.
}
// Iterate through the results.
for {
	var values []bigquery.Value
	err := it.Next(&values)
	if err == iterator.Done {
		break
	}
	if err != nil {
		// TODO: Handle error.
	}
	fmt.Println(values)
}