A complete Coder workspace template for querying Google BigQuery from Jupyter notebooks with integrated GCP authentication and AI agents (Claude Code).
Note
This majority of this README, while mostly accurate, is written with AI. The template itself is written by the Coder team.
This is a Coder workspace template (main.tf) that provides:
- π GCP External Authentication - Pre-configured Google Cloud integration
- π Jupyter Lab - Ready-to-use data science environment
- π€οΈ BigQuery Integration - Access to public weather datasets
- π οΈ Development Tools - Code-server, JetBrains, and Claude Code
- β‘ Complete Setup - Everything configured and ready to deploy
Before deploying, watch a video explaining how this works!
-
Deploy the template to your Coder instance:
# Upload main.tf as a workspace template coder templates push bigquery-jupyter -
Configure required variables:
anthropic_api_key- For Claude Code integrationdocker_socket- Docker connection (optional)
-
Ensure GCP External Auth is configured (see configuration section below)
- Create workspace from the
bigquery-jupytertemplate - Access Jupyter Lab from the workspace dashboard
- Start analyzing using the pre-loaded weather analysis notebooks
π REQUIRED: This template uses BigQuery with OpenID Connect (OIDC) authentication through Coder's external auth system.
First, set up BigQuery to accept OIDC tokens from your identity provider:
- Enable BigQuery OIDC in your Google Cloud project
- Configure identity pool and provider for your Coder instance
- Set up IAM bindings for BigQuery access
Required Documentation:
Configure your Coder deployment to provide GCP tokens that work with BigQuery OIDC:
CODER_EXTERNAL_AUTH_0_TYPE=gcp
CODER_EXTERNAL_AUTH_0_CLIENT_ID="your-gcp-client-id"
CODER_EXTERNAL_AUTH_0_CLIENT_SECRET="your-gcp-client-secret"
CODER_EXTERNAL_AUTH_0_SCOPES="https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/sqlservice.login https://www.googleapis.com/auth/bigquery"
CODER_EXTERNAL_AUTH_0_AUTH_URL="https://accounts.google.com/o/oauth2/v2/auth"
CODER_EXTERNAL_AUTH_0_TOKEN_URL="https://oauth2.googleapis.com/token"
CODER_EXTERNAL_AUTH_0_DISPLAY_NAME="Google Cloud"
CODER_EXTERNAL_AUTH_0_DISPLAY_ICON="/icon/gcp.png"Additional Documentation:
The main.tf workspace template automatically uses this external auth configuration:
data "coder_external_auth" "gcp" {
id = "gcp"
}This enables seamless BigQuery access within workspaces using OIDC tokens.
To verify your setup works:
coder external-auth access-token gcpThis should return a valid access token.
File: basic-weather-analysis.ipynb
Complete starter notebook featuring:
- β Automatic requirements.txt installation and authentication setup
- π Basic GSOD dataset querying (500 records)
- π‘οΈ Temperature, precipitation, wind, and visibility analysis
- π Weather station distribution analysis
- π¨ Multiple visualization types
File: regional-temperature-analysis.ipynb
Advanced regional analysis notebook with:
- π Geographic region classification by station patterns
- π 6 comprehensive visualizations (violin plots, trends, heatmaps)
- π‘οΈ Regional temperature comparisons and seasonal patterns
- π Temperature vs precipitation relationships
- πΊοΈ Interactive climate heatmap
File: weather-analysis-script.py
Complete Python script version that can be run independently:
python3 weather-analysis-script.pyThe key breakthrough uses Coder's external auth token:
import subprocess
from google.oauth2 import credentials
from google.cloud import bigquery
def get_access_token():
result = subprocess.run(
['coder', 'external-auth', 'access-token', 'gcp'],
capture_output=True, text=True, check=True
)
return result.stdout.strip()
# Create authenticated BigQuery client
access_token = get_access_token()
creds = credentials.Credentials(token=access_token)
client = bigquery.Client(credentials=creds, project='coder-vertex-demos')Install all dependencies using:
pip install -r requirements.txtOr the example notebooks automatically install from requirements.txt:
subprocess.check_call([sys.executable, '-m', 'pip', 'install', '-r', 'requirements.txt'])Key packages:
google-cloud-bigquery- BigQuery Python clientdb-dtypes- BigQuery data type support for pandaspyarrow- Efficient data serializationpandas,matplotlib,seaborn- Data analysis and visualization
SELECT *
FROM `bigquery-public-data.samples.gsod`
LIMIT 500SELECT
station_number,
year,
month,
mean_temp,
total_precipitation
FROM `bigquery-public-data.samples.gsod`
WHERE mean_temp IS NOT NULL
AND year >= 1950
LIMIT 5000π― Pro Tip: Always request analysis to be done in Jupyter notebooks!
- "Show me temperature trends by geographic region in a notebook"
- "Find the wettest weather stations with visualizations"
- "Compare seasonal weather patterns across different years"
- "Identify extreme weather events with interactive plots"
- "Create a correlation analysis notebook for weather variables"
- "Build a time series forecasting notebook for temperature trends"
- "Make a clustering notebook for weather stations by climate patterns"
- "Create an anomaly detection notebook for unusual weather readings"
- "Create an interactive weather dashboard in a notebook"
- "Make a comprehensive heatmap analysis of weather patterns"
- "Generate statistical plots comparing regions and seasons"
- "Build a multi-chart weather analysis notebook"
# Verify external auth is working
coder external-auth access-token gcp
# Check token permissions
gcloud auth print-access-token # Should match coder token# If db-dtypes missing:
!pip install db-dtypes pyarrow
# If permission errors in Jupyter:
subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'package-name'])- Ensure you're using a valid GCP project ID
- Public datasets work with any project that has BigQuery enabled
- Default project:
'coder-vertex-demos'
GSOD Dataset: bigquery-public-data.samples.gsod
- Source: Global Summary of the Day weather data
- Coverage: Worldwide weather stations, historical data from 1929+
- Size: 114+ million records, 31 columns
- Key Fields: temperature, precipitation, wind speed, visibility, weather events
Sample Data Fields:
station_number- Weather station identifiermean_temp- Average temperature (Β°F)total_precipitation- Daily precipitation (inches)mean_wind_speed- Average wind speed (knots)year,month,day- Date information
- Authentication: Use
credentials.Credentials(token=access_token)with Coder's GCP token - Project ID: Always specify a valid project even for public datasets
- Dependencies: BigQuery requires
db-dtypesandpyarrowfor pandas integration - Error Handling: Import
subprocessin cells where it's used - Performance: Use LIMIT clauses for initial exploration, then scale up
graph TB
A[main.tf Template] --> B[Coder Workspace]
B --> C[GCP External Auth]
C --> D[BigQuery Access]
D --> E[Jupyter Lab]
E --> F[Analysis Notebooks]
F --> G[Weather Visualizations]
H[Docker Container] --> B
I[Claude Code] --> B
J[Code Server] --> B
K[Git Clone Module] --> B
bigquery-jupyter/
βββ README.md # Template documentation
βββ main.tf # π― Coder workspace template (deploy this!)
βββ basic-weather-analysis.ipynb # Sample weather analysis notebook
βββ regional-temperature-analysis.ipynb # Advanced regional analysis notebook
βββ weather-analysis-script.py # Standalone Python script
βββ requirements.txt # Python dependencies for notebooks
βββ .gitignore # Git ignore patterns
βββ CLAUDE.md # Detailed usage guide for workspaces
Contributions are welcome! This is a community template in the coder-contrib organization.
To contribute:
- Fork the repository
- Test the template by deploying to a Coder instance
- Verify notebooks work in fresh workspace environments
- Update template if Coder provider versions change
- Add new features following established patterns
- Submit a pull request with your improvements
- Coder External Auth Documentation
- BigQuery Public Datasets
- BigQuery Python Client Reference
- GSOD Dataset Documentation
π Ready to deploy your BigQuery Jupyter template!
This Coder workspace template provides everything needed for BigQuery data analysis with integrated GCP authentication, development tools, and sample notebooks.
