
Chris Parmer
2026-11-16
Polars BigQuery demo
Query BigQuery from Polars in Python, with Dash and Plotly
TL;DR
- polars-bigquery is the Polars team's connector for Google BigQuery. It reads tables and query results straight into Polars, streaming Apache Arrow data from the BigQuery Storage Read API in Rust. The first release came out in May 2026, and the current one, 0.3.2, on November 11, 2026.
- Its main feature is pushdown: scan_table returns a lazy Polars frame, and the columns you select and the filters you write are sent to BigQuery, so only the data you need leaves Google's servers.
- That suits any Dash app whose data already sits in BigQuery, such as meter reads for a utility, trades for a desk, clinical data for a study team, or event logs for an operations team.
- Our example is Heat Desk, a weather risk app for power load centers on 22.9 million daily readings from NOAA's public BigQuery dataset. Pushdown cut one year's read from 403 MB to 0.1 MB when the app only needed hot days in Texas.

What is polars-bigquery?
A lot of company data already lives in BigQuery: meter reads, trades, claims, lab results, and the public datasets Google hosts. The usual way to chart it in Python is to run SQL, wait for the job, pull the result through a client library, and then convert it to a dataframe. That works, but every step copies data, and an app that grows past a few million rows starts to run out of memory.
polars-bigquery connects BigQuery to Polars, one of the two packages we recommend for loading data in new apps (our Polars demo covers the lazy API, and our overview of Python packages for data shows how it fits with the rest). scan_table gives you a LazyFrame over a BigQuery table, and when you call .collect(), Polars works out which columns and rows it needs and asks BigQuery for only those. read_query runs any GoogleSQL query and streams the result into a DataFrame. Both run inside a Dash callback, so a dropdown can trigger a fresh read from BigQuery.
With a coding agent you don't need to remember the API. You bring the question and enough vocabulary to ask for the right calls.
What's possible
- Lazy table scans: client.scan_table("project.dataset.table") returns a Polars LazyFrame. Nothing is read until .collect().
- Column pushdown: .select([...]) on the scan reads only those columns from BigQuery storage.
- Filter pushdown: .filter(...) with comparisons, &, |, is_in, is_null, and string matches such as str.starts_with is translated to a BigQuery row restriction. Anything it can't translate is applied in Polars, so results stay exact.
- SQL: client.read_query(sql) for joins, wildcard tables, and anything easier to write in GoogleSQL, and read_query(sql, dry_run=True) to see the bytes a query will process before you run it.
- Whole tables: client.read_table(...) for small lookup tables.
- Credentials: Application Default Credentials and a quota_project_id that pays for the reads.
Demo App: Heat Desk
Heat Desk is the app a utility's load forecasting team, a power trader, or a grid planner would want next to their models: where it's hotter or colder than normal, how load centers compare, and how a given summer stacks up. It runs on the Global Surface Summary of the Day (GSOD) from NOAA, which Google hosts in BigQuery as bigquery-public-data.noaa_gsod, one table per year. The public copy ends on August 27, 2025.
Start with the skeleton:
Prompt: Build a Dash app called Heat Desk with Plotly charts, Inter font, light theme and purple accents. Use polars-bigquery with Application Default Credentials and quota_project_id from an environment variable. Tabs: Map, Load centers, Summer, Live query, Under the hood. Keep BigQuery reads in a build script that writes Parquet, and let only the Live query tab read BigQuery from a callback.
Load 26 years of station data
The build script reads the U.S. station list, then scans one GSOD table per year from 2000 to 2025, keeping 8 of the 33 columns and only U.S. station IDs:
import polars as plimport polars_bigquerywith polars_bigquery.Client(quota_project_id="my-gcp-project") as client:us = client.scan_table("bigquery-public-data.noaa_gsod.stations").filter(pl.col("country") == "US").collect()for year in range(2000, 2026):df = (client.scan_table(f"bigquery-public-data.noaa_gsod.gsod{year}").select(["stn", "wban", "year", "mo", "da", "max", "min", "temp"]).filter(pl.col("stn").is_in(us["usaf"].unique().to_list())).collect())
The is_in filter on the U.S. station IDs goes to BigQuery as stn IN (...), so the 26 scans return only U.S. rows, about 1.5 seconds per year.
Prompt: Write build_data.py: read bigquery-public-data.noaa_gsod.stations filtered to country == "US", then for each year 2000-2025 scan_table gsod{year}, select stn, wban, year, mo, da, max, min, temp, filter stn with is_in on the U.S. IDs, treat 9999.9 as missing, and save per station and year: cooling and heating degree days (base 65°F), days at 100°F or more, and the hottest reading. Also save daily rows for the airport stations of 12 load centers.
Map: which stations ran hotter than normal
The Map page, shown at the top, compares any year from 2000 to 2024 with each station's own 2001-2020 average, so a forecaster can see at a glance which regions ran hot. In 2024, 77% of stations with enough data had more cooling degree days than their average.
Prompt: On the Map tab, for the chosen year, keep stations with at least 330 days of data and at least 15 years in 2001-2020. Plot a Scattergeo of the U.S. colored by the percent change in cooling or heating degree days against the station's 2001-2020 mean, blue to pink centered at 0, with KPI cards for station count, share above average, median change and the biggest increase.
Load centers: cooling demand by year

Cooling degree days add up how far each day's mean temperature is above 65°F, a standard proxy for air conditioning load, and this page compares them year by year across metros next to the count of 100°F days. Phoenix reached 100°F on 151 days in 2020.
Prompt: On the Load centers tab, a multi-select of metros; for each, a line of cooling degree days per year and grouped bars of days at 100°F or above, 2000-2024, from the airport station's daily rows.
Summer: one year against all the others

The band shows the 10th to 90th percentile daily high for each calendar day in the other 24 years, which puts one summer in context at a glance. In Dallas-Fort Worth in 2023, the daily high was above the band on 22 of August's 31 days.
Prompt: On the Summer tab, pick a metro and year. Plot the year's daily highs over a 10th-90th percentile band and a median line built from 2000-2024 excluding that year, 7-day smoothed, with a dashed line at 100°F and KPI cards for days at 100°F+, the hottest day and days above the 90th percentile.
Live query: BigQuery from a callback

This page reads BigQuery when you click the button, for any state, year, and temperature threshold; for Texas in 2023 at 105°F the read took 2.49 seconds. The panel on the right shows the filter polars-bigquery sent, a station IN list plus max >= 105, so BigQuery returned only the hot days.
Prompt: On the Live query tab, inputs for state, year and a temperature threshold, and a button. In the callback, scan_table gsod{year}, select 6 columns, filter stn is_in the state's IDs and max >= the threshold, collect, join to the station list on stn and wban, and show a bar chart of stations per day, the read time, and the hottest stations in a table.
Under the hood: what pushdown saves

We read the 2025 table four ways, adding one step of pushdown each time: the whole table, 6 columns, Texas stations only, and days of 100°F or more. The data that reached Polars fell from 402.6 MB to 0.1 MB. For SQL, read_query with dry_run=True reports the bytes a query will process before you pay for it.
Prompt: On the Under the hood tab, show bar charts of MB in Polars and seconds for: read_table of gsod2025, scan_table with 6 columns, plus a Texas is_in filter, plus max >= 100. Add KPI cards with BigQuery dry-run bytes for all columns and for the 6 columns.
Other apps you can build with polars-bigquery
- Energy: hourly smart meter reads in BigQuery, scanned by feeder and date range, for a load research app.
- Finance: trade and quote tables, filtered by symbol and session, for a transaction cost app.
- Pharma: clinical data warehouses in BigQuery, filtered by study and visit, for a data review app.
- Retail and operations: event tables partitioned by day, with partition filters pushed down, for an operations review app.
- Public data: Google's public datasets, such as GSOD weather, census, and patents, joined to your own tables.
polars-bigquery versions and what's in 0.3.2
polars-bigquery is young and moving quickly: 0.0.1 came out on May 28, 2026, and 0.3.2 on November 11. Its current documentation covers:
- Filter pushdown covers comparisons, & and | (with partial pushdown when only one side can be translated), is_null, fill_null, coalesce, string matches, and when/then/otherwise.
- read_query has dry_run=True and use_query_cache.
- For query results over 10 GB, the guide shows writing the result to a table and scanning it with scan_table.
- It needs Python 3.11 and Polars 1.43 or later.
is_in isn't in the documentation's list, but in our runs it compiled to stn IN (...).
Running polars-bigquery on Plotly Cloud and Dash Enterprise
- Use a service account, not your own login. Give it the BigQuery Read Session User role (and BigQuery Job User for read_query), store its key as a secret in Plotly Cloud or Dash Enterprise, and point GOOGLE_APPLICATION_CREDENTIALS at it. Our deployed copy of Heat Desk has no credentials and reads a 2 MB Parquet snapshot instead.
- Read in a build step, filter live. The Map, Load centers, and Summer pages read Parquet written by the build script; only the Live query page goes to BigQuery, so the app stays fast and the bill stays small.
- Select columns and filter early. Every column you don't select is data BigQuery doesn't send and you don't pay to read. In our test, the six columns we needed were 24% of the table.