tree: 271efe4c8d0c2b37580d7371058b27e91060990d [path history] [tgz]
  1. benchmarks/
  2. connection/
  3. datatransfer/
  4. reservation/
  5. storage/
  6. bigquery.go
  7. bigquery.replay
  8. bigquery_test.go
  9. CHANGES.md
  10. copy.go
  11. copy_test.go
  12. dataset.go
  13. dataset_test.go
  14. doc.go
  15. error.go
  16. error_test.go
  17. examples_test.go
  18. external.go
  19. external_test.go
  20. extract.go
  21. extract_test.go
  22. file.go
  23. file_test.go
  24. gcs.go
  25. go.mod
  26. go.sum
  27. go_mod_tidy_hack.go
  28. iam.go
  29. iam_test.go
  30. inserter.go
  31. inserter_test.go
  32. integration_test.go
  33. iterator.go
  34. iterator_test.go
  35. job.go
  36. job_test.go
  37. load.go
  38. load_test.go
  39. model.go
  40. model_test.go
  41. nulls.go
  42. nulls_test.go
  43. oc_test.go
  44. params.go
  45. params_test.go
  46. query.go
  47. query_test.go
  48. random.go
  49. read_test.go
  50. README.md
  51. routine.go
  52. routine_test.go
  53. schema.go
  54. schema_test.go
  55. standardsql.go
  56. standardsql_test.go
  57. table.go
  58. table_test.go
  59. value.go
  60. 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 {
		break
	}
	if err != nil {
		// TODO: Handle error.
	}
	fmt.Println(values)
}