Skip to content

Is polars or pandas required to work with duckdb in marimo? #3447

Answered by mscolnick
sskagemo asked this question in Q&A
Discussion options

You must be logged in to vote

hi @sskagemo, using mo.sql is a special function that will use duckdb under the hood (currently its duckdb, but may be other drivers/dialects in future). It does return a polars dataframe.

If you want to just use duckdb, you can do that too with:

import duckdb

er = duckdb.sql(
    f"""
    SELECT *
    FROM read_json('https://wiki.mozilla.org/images/f/ff/Example.json.gz', 
    auto_detect=true, compression="gzip", format='newline_delimited');
    "
)
er # DuckDBRelation

The reason we return a df instead of the DuckDBRelation in our own .sql is so that we have the flexibility to change the underlying driver, while still returning a dataframe.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@sskagemo
Comment options

Answer selected by sskagemo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants