How to start with google bigquery

Here is the list of thing I noticed when started to work with bigquery.
First you need to create a project —
That’s how you create a service key for bigquery — Select your project on the very top of the page, and then create JSON key. And don’t forget to set is as a Product Owner for the project (to make sure you don’t have any troubles with permissions).
After that you need to specify path to that file via environment variable GOOGLE_APPLICATION_CREDENTIALS.
Now you are ready to start the small project. Here is an example on using public data —

Queries example

Bigquery is mostly an SQL, but it has some additions. For instance, it can have nested array of structures.
For instance, you could have a list of products inside your order with a scheme like that:

You can select orders with product ids separated by a semicolon like that:

More on that —

Or you can join product names from Products table:

Here is a list of functions —
Here is an article on how to work with arrays —

Working with bigquery in go

You can use module

Here is how you can work with query parameters —
Here is a little example in go:

You could do a healthcheck with a query like this:

Similar Posts