Google Cloud Platform

Many services in Google Cloud Platform have very good native libraries for Python.

The recommended way to authenticate is by using Google Application Credentials. You can use them in Deepnote by performing these steps:

1. Follow the guide to create a service account and download its key

Make sure the service account has correct permissions for resources you want to use, such as BigQuery or Storage buckets.

2. Open the service account JSON in a text editor and copy its contents

3. Create a new Environment variable connection, and paste the JSON in the value. You can pick anything for the key and connection name

4. Add the connection to your project

5. Write the JSON to a file on the file system, create an environment variable called GOOGLE_APPLICATION_CREDENTIALS and set it to the path of the service account key

import os
with open('/home/jovyan/.service_account_key.json', 'w') as f:

Steps 1-3 are a one time setup, then add the connection to every project where you need your credentials, and include the snippet from step 5 at the top of every notebook where you need to access the Google Cloud services.