tree: 847b4d6ecf650615b84aa059769fb8ec35c80e21 [path history] [tgz]
  1. CHANGES.md
  2. README.md
  3. benchmarks/
  4. bigquery.go
  5. bigquery.replay
  6. connection/
  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. iam.go
  27. iam_test.go
  28. inserter.go
  29. inserter_test.go
  30. integration_test.go
  31. iterator.go
  32. iterator_test.go
  33. job.go
  34. job_test.go
  35. load.go
  36. load_test.go
  37. model.go
  38. model_test.go
  39. nulls.go
  40. nulls_test.go
  41. oc_test.go
  42. params.go
  43. params_test.go
  44. query.go
  45. query_test.go
  46. random.go
  47. read_test.go
  48. reservation/
  49. routine.go
  50. routine_test.go
  51. schema.go
  52. schema_test.go
  53. standardsql.go
  54. standardsql_test.go
  55. storage/
  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)
}