examples/sql/README.md
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_persistent_db.py shows hows to connect to a duckdb persistent databaseconnect_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 sqlat 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:
uvuvx 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.