tree: b601710e0fe74a7b06b16f62bf37a372ea4b3686 [path history] [tgz]
  1. benchmarks/
  2. connection/
  3. dataexchange/
  4. datatransfer/
  5. internal/
  6. migration/
  7. reservation/
  8. storage/
  9. .release-please-manifest.json
  10. bigquery.go
  11. bigquery.replay
  12. bigquery_test.go
  13. CHANGES.md
  14. copy.go
  15. copy_test.go
  16. dataset.go
  17. dataset_integration_test.go
  18. dataset_test.go
  19. doc.go
  20. error.go
  21. error_test.go
  22. examples_test.go
  23. external.go
  24. external_test.go
  25. extract.go
  26. extract_test.go
  27. file.go
  28. file_test.go
  29. gcs.go
  30. go.mod
  31. go.sum
  32. iam.go
  33. iam_test.go
  34. inserter.go
  35. inserter_test.go
  36. integration_test.go
  37. intervalvalue.go
  38. intervalvalue_test.go
  39. iterator.go
  40. iterator_test.go
  41. job.go
  42. job_test.go
  43. load.go
  44. load_test.go
  45. model.go
  46. model_test.go
  47. nulls.go
  48. nulls_test.go
  49. oc_test.go
  50. params.go
  51. params_test.go
  52. query.go
  53. query_test.go
  54. random.go
  55. read_test.go
  56. README.md
  57. release-please-config.json
  58. routine.go
  59. routine_integration_test.go
  60. routine_test.go
  61. schema.go
  62. schema_test.go
  63. standardsql.go
  64. standardsql_test.go
  65. table.go
  66. table_integration_test.go
  67. table_test.go
  68. value.go
  69. value_test.go
bigquery/README.md

BigQuery Go Reference

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 {  // from "google.golang.org/api/iterator"
		break
	}
	if err != nil {
		// TODO: Handle error.
	}
	fmt.Println(values)
}