tree: 2d11e368d6bb4096b3e4e7ebb6d78c72e180977a [path history] [tgz]
  1. .repo-metadata.json
  2. CHANGES.md
  3. README.md
  4. benchmarks/
  5. bigquery.go
  6. bigquery.replay
  7. copy.go
  8. copy_test.go
  9. dataset.go
  10. dataset_test.go
  11. datatransfer/
  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. routine.go
  47. routine_test.go
  48. schema.go
  49. schema_test.go
  50. standardsql.go
  51. standardsql_test.go
  52. storage/
  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)
}