A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
SQL 🛢️
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.pyshows hows to query Pandas or Polars dataframesparemetrizing_sql_queries.pyshows hows to parametrize queries with Python valuesread_csv.pyshows hows to read CSV data into duckdbread_json.pyshows hows to read JSON data into duckdbread_parquet.pyshows hows to read parquet data into duckdbconnect_to_persistent_db.pyshows hows to connect to a duckdb persistent databaseconnect_to_sqlite.pyshows hows to connect to a SQLite databaseconnect_to_postgres.pyshows hows to connect to a PostgreSQL databaseconnect_to_motherduck.pyshows hows to connect to motherduckhistograms.pyshows 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 sqlat the command-line.
Consult the duckdb documentation for a comprehensive guide on duckdb.
Running examples
The requirements of each notebook are serialized in them as a top-level comment. Here are the steps to open an example notebook:
- Install
uv - Open an example with
uvx marimo edit --sandbox <notebook-url>
[!TIP] The
--sandboxflag opens the notebook in an isolated virtual environment, automatically installing the notebook's dependencies 📦
You can also open notebooks without uv, in which case you'll need to
manually install marimo
first. Then run marimo edit <notebook-url>; however, you'll also need to
install the requirements yourself.