These examples show how to use marimo's built-in support for SQL, which is powered by duckdb, a fast in-process analytical database.
querying_dataframes.py
shows hows to query Pandas or Polars dataframesparemetrizing_sql_queries.py
shows hows to parametrize queries with Python valuesread_csv.py
shows hows to read CSV data into duckdbread_json.py
shows hows to read JSON data into duckdbread_parquet.py
shows hows to read parquet data into duckdbconnect_to_sqlite.py
shows hows to connect to a SQLite databaseconnect_to_postgres.py
shows hows to connect to a PostgreSQL databaseconnect_to_motherduck.py
shows hows to connect to motherduckhistograms.py
shows hows to plot histograms of a column's valuesmisc/
contains illustrative examples
Tip
For a broad overview of using SQL in marimo, run marimo tutorial sql
at the
command-line.
Consult the duckdb documentation for a comprehensive guide on duckdb.
The requirements of each notebook are serialized in them as a top-level comment. Here are the steps to open an example notebook:
- Install marimo
- Install
uv
- Open an example with
marimo edit --sandbox <notebook.py>
.
Tip
The --sandbox
flag opens the notebook in an isolated virtual environment,
automatically installing the notebook's dependencies 📦
You can also open notebooks without uv
, with just marimo edit <notebook.py>
;
however, you'll need to install the requirements yourself.