DuckDB SQL IPython Extension
August 26, 2025 ยท View on GitHub
Loads JupySQL extension with DuckDB setup (incl. GCS auth).
Setup
Use in a notebook as follows:
-
Install via pip if not yet installed:
pip install git+https://github.com/grobgl/duckdb-sql-ipython-ext -
(optional) Prepare GCS credentials:
- Create HMAC keys and store them as
GCS_KEY_IDandGCS_SECRETenvironment variables. - If using a
.envfile, these may have to be loaded into a notebook usingpython-dotenv:%load_ext dotenv %dotenv /home/serenitydev/.env
- Create HMAC keys and store them as
-
Load extension:
%load_ext duckdb_sql
Usage
See JupySQL.
%sql select * from 'gs://example-bucket/**/*-example.parquet' limit 10;
Multi line:
%%sql
select *
from 'gs://example-bucket/**/*-example.parquet'
limit 10
Store result to variable:
%%sql example_df <<
select * from 'gs://example-bucket/**/*-example.parquet' limit 10;