
To get updates like this one delivered to your inbox, subscribe to our newsletter.
Newsletter #5
Hi! đ Youâre reading the fifth marimo newsletter.
We have two big announcements!
- marimo now has built-in support for SQL â query dataframes, CSVs, tables and more, and get results back as Python dataframes.
- Weâve standardized a third-party plugin API, based on anywidget. This makes it possible for you to make your own widgets and bring them into marimo!
Weâre also starting a new tradition that weâre calling the spotlight: every newsletter, weâll feature a project by a member of the marimo community. This month, our spotlight doubles as an announcement, since weâre featuring Trevor Manzâs work on anywidget and how it integrates with marimo.
Working on something related to machine learning, data science, or interactive computing that youâd like us to feature next month? Hit reply to let us know!
đŚđ˘Announcing SQL support
For an interactive tutorial, run pip install --upgrade marimo && marimo tutorial sql
at your command line.
SQL cells in marimo are easy-to-use and powerful at the same time, letting you query almost anything while mixing and matching Python and SQL.
How SQL works
Create a SQL cell. Create SQL cells with a single click:
Query anything. marimo uses duckdb to run queries, so itâs compatible with a large number of data sources. For example, hereâs a SQL query on a Pandas dataframe (live example) â notice how much simpler it is than the equivalent Pandas code:
And hereâs how you might query CSVs or Parquet files, local or remote:
SELECT * FROM 's3://my-bucket/file.parquet';
-- or
SELECT * FROM read_csv('path/to/example.csv');
-- or
SELECT * FROM read_parquet('path/to/example.parquet');
-- or
SELECT * FROM 'https://datasets.marimo.app/cars.csv';
With a bit of set up and tuning, you can even query Postgres tables. And you can even run joins across heterogeneous data sources, such as a Postgres table and a dataframe, in a single query.
Get results back as Python. Query results are returned to you as Polars or Pandas dataframes, making it seamless for Pythonistas to get back in the flow.
Build dynamic queries. You can even interpolate Python values to dynamically build queries, using the familiar {}
syntax from Python f-strings.
SQL cells are reactive â interact with the dropdown and marimo will automatically re-run your query if autorun is enabled. Worried about expensive queries? Just disable autorun.
Bonus: SQL even works in WebAssembly notebooks
As a bonus, SQL queries even work entirely in the browser (no server required!). Check out our this tutorial notebook for an example.
đ Spotlight on anywidget, and announcing our plugin API
Learn more about our plugin API at our blog.
Weâre excited to announce that weâre opening up a public plugin API for building custom UI elements, or âwidgetsâ! In particular, weâve standardized on anywidget as our third-party plugin API.
anywidget is a Python library that simplifies creating and publishing custom widgets that can be used in interactive programming environments, developed by Trevor Manz, PhD candidate at Harvard. We strongly believe in anywidgetâs mission to provides a single interface for developing embeddable widgets inside other applications, such as Panel, Jupyter, and, of course, marimo.
The upshot of our anywidget adoption is two-fold:
- You can now use any anywidget in marimo with just one line of code, and it automatically becomes reactive. For example, check out Trevorâs demo at this link to see how marimo brings quak, an interactive data table implemented with anywidget, to life, with selections automatically updating a downstream plot.
- You can now develop custom widgets for marimo, limited only by your imagination; learn more at our docs and anywidgetâs.
As an example, hereâs how youâd use the anywidget quak in a marimo notebook:
import marimo as mo
import polars as pl
import quak
df = pl.read_parquet("https://github.com/uwdata/mosaic/raw/main/data/athletes.parquet")
widget = mo.ui.anywidget(quak.Widget(df))
widget
Weâre passionate about developer experience, and itâs clear to us that Trevor is too â anywidget comes with excellent devX for creating widgets with either vanilla JavaScript or frameworks like React and Svelte.
Weâre excited to see the innovations that youâll bring to marimo with anywidget. Happy building!
-Akshay & Myles
