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