Connect Streamlit to Google BigQuery
Introduction
This guide explains how to securely access a BigQuery database from Streamlit Cloud. It uses the
google-cloud-bigquery library and
Streamlit's secrets management.
Create a BigQuery database
If you already have a database that you want to use, feel free
to skip to the next step.
For this example, we will use one of the sample datasets from BigQuery (namely the shakespeare table). If you want to create a new dataset instead, follow Google's quickstart guide.
Enable the BigQuery API
Programmatic access to BigQuery is controlled through Google Cloud Platform. Create an account or sign in and head over to the APIs & Services dashboard (select or create a project if asked). As shown below, search for the BigQuery API and enable it:
Create a service account & key file
