Skip to content

Example programs

Alexander Diemand edited this page Aug 3, 2023 · 1 revision

Query from a go program

Look at the code in examples/simple_query_in_go/main.go of a simple program in go that sends a query to BigQuery and outputs the results received.

image

As a demonstration, this program extracts data for the last block in the selected epoch.

To run this program one first has to be authenticated with GCP:

#1 gcloud auth application-default login

Then, setup the go project, assuming you have an installation (golang.org):

#2 go mod tidy -v

Build the program:

#3 go build

Run it with either:

#4a go run . --epoch_no 321

#4b ./simple_query -epoch_no 321

Clone this wiki locally