Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Feb 13, 2026. It is now read-only.

Latest commit

 

History

History
History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

Outline

Google Cloud BigQuery Samples

This project includes samples for running Google Cloud BigQuery

Installing Dependencies

Install the dependencies, namely google_api_big_query, using Mix:

mix deps.get

Authentication

Authentication is typically done through Application Default Credentials which means you do not have to change the code to authenticate as long as your environment has credentials. Start by creating a Service Account key file. This file can be used to authenticate to Google Cloud Platform services from any environment. To use the file, set the GOOGLE_APPLICATION_CREDENTIALS environment variable to the path to the key file, for example:

export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service_account.json

Running the Samples

Use Interactive Elixir and Mix to compile and run the samples

iex -S mix

Now you can run the samples! For example, to list your cloud bigquery buckets, type the following into the Interactive Elixir shell:

iex(1)> sql = "SELECT TOP(corpus, 10) as title, COUNT(*) as unique_words
                FROM [publicdata:samples.shakespeare]"
iex(2)> GoogleApi.BigQuery.Samples.sync_query("YOUR_PROJECT_ID", sql)
title: hamlet
unique_words: 5318
title: kinghenryv
unique_words: 5104
title: cymbeline
unique_words: 4875
title: troilusandcressida
unique_words: 4795
title: kinglear
unique_words: 4784
title: kingrichardiii
unique_words: 4713
title: 2kinghenryvi
unique_words: 4683
title: coriolanus
unique_words: 4653
title: 2kinghenryiv
unique_words: 4605
title: antonyandcleopatra
unique_words: 4582
:ok
Morty Proxy This is a proxified and sanitized view of the page, visit original site.