🍃 Announcing molab:

Read our announcement

Support for SQL

Execute SQL queries directly in marimo notebooks with support for DuckDB, PostgreSQL, MySQL, SQLite and more. Interactive tables, visual tools, and seamless Python integration.

Support for SQL

While marimo is a Python-first notebook environment, it recognizes that modern data analysis often requires working with data stored in databases. Rather than forcing you to switch between tools or write verbose Python database connection code, marimo provides first-class SQL support. You can query your data where it lives, then seamlessly transition to Python for advanced analytics, machine learning, or visualization all within the same notebook environment!.

Whether you’re a data analyst, scientist, or engineer, marimo’s integrated approach eliminates the friction normally associated with multi-language data workflows.

SQL cells

SQL cells work the same as Python cells in marimo’s reactive system. When you execute a SQL query, the results become a Python variable that other cells can reference. In other words, changes to your SQL queries automatically trigger updates in dependent Python cells, maintaining marimo’s reactive consistency across both languages. This feature creates a smooth workflow where database queries feed into your analytical pipeline without manual data transfer steps.

This approach is particularly useful for exploratory data analysis where you might need to refine your data extraction logic while developing your analysis. Instead of repeatedly copying query results between tools, your notebook stays synchronized as both your queries and analysis evolve.

Integrated backends

When you write SQL, marimo assumes it’s DuckDB in memory by default, but marimo can also connect to PostgreSQL, SQLite, MySQL, and many other backends through standard database connectors.

DuckDB serves as an excellent choice for analytical workloads. It’s embedded directly in your notebook process, requires no setup, and provides exceptional performance for analytical queries on moderate sized datasets. You can load CSV files, Parquet files, or other data sources into DuckDB and start querying immediately.

PostgreSQL, MySQL, and other traditional databases work seamlessly when you need to query production systems or shared data warehouses. marimo handles the connection management and credential configuration, making it easy to switch between different data sources within the same notebook.

Cloud data warehouses and datalakes such as Snowflake, Apache Iceberg, BigQuery, and Redshift are supported through their respective Python connectors.

The consistent SQL interface means your query skills work across all these backends, while marimo handles the connection details and result formatting automatically.

Interactive tooling

SQL cells output a DataFrame that can be explored visually.

You can sort columns, filter rows, search for specific values, and get statistical summaries without writing additional code.