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