diff --git a/examples/sql/connect_to_motherduck.py b/examples/sql/connect_to_motherduck.py index e5d777e0d36..6b7498d115d 100644 --- a/examples/sql/connect_to_motherduck.py +++ b/examples/sql/connect_to_motherduck.py @@ -3,8 +3,9 @@ # dependencies = [ # "altair==5.4.1", # "duckdb==1.1.0", +# "polars==1.18.0", +# "pyarrow==18.1.0", # "marimo", -# "pandas==2.2.3", # ] # /// diff --git a/examples/sql/connect_to_postgres.py b/examples/sql/connect_to_postgres.py index 13520413a58..e44ed68125b 100644 --- a/examples/sql/connect_to_postgres.py +++ b/examples/sql/connect_to_postgres.py @@ -3,7 +3,8 @@ # dependencies = [ # "duckdb==1.1.1", # "marimo", -# "pandas==2.2.3", +# "polars==1.18.0", +# "pyarrow==18.1.0", # "requests==2.32.3", # ] # /// diff --git a/examples/sql/connect_to_sqlite.py b/examples/sql/connect_to_sqlite.py index 5e20883d6ed..a6ca6cebe4c 100644 --- a/examples/sql/connect_to_sqlite.py +++ b/examples/sql/connect_to_sqlite.py @@ -3,19 +3,20 @@ # dependencies = [ # "duckdb==1.1.1", # "marimo", -# "pandas==2.2.3", +# "polars==1.18.0", +# "pyarrow==18.1.0", # "requests==2.32.3", # ] # /// import marimo -__generated_with = "0.9.1" +__generated_with = "0.10.7" app = marimo.App(width="medium") @app.cell(hide_code=True) -def __(mo): +def _(mo): mo.md( r""" # Connect to SQLite @@ -31,7 +32,7 @@ def __(mo): @app.cell(hide_code=True) -def __(): +def _(): import marimo as mo @@ -53,7 +54,7 @@ def download_sample_data(): @app.cell(hide_code=True) -def __(mo): +def _(mo): mo.accordion( { "Tip: Creating SQL Cells": mo.md( @@ -73,7 +74,7 @@ def __(mo): @app.cell -def __(INFORMATION_SCHEMA, mo): +def _(INFORMATION_SCHEMA, TABLES, mo): _df = mo.sql( f""" -- Boilerplate: detach the database so this cell works when you re-run it @@ -90,13 +91,13 @@ def __(INFORMATION_SCHEMA, mo): @app.cell(hide_code=True) -def __(mo): +def _(mo): mo.md(r"""Once the database is attached, you can query it with SQL. For example, the next cell computes the average track length of each composer in the chinook database.""") return @app.cell -def __(chinook, mo, track): +def _(chinook, mo, track): _df = mo.sql( f""" SELECT composer, MEAN(Milliseconds) as avg_track_ms from chinook.track GROUP BY composer ORDER BY avg_track_ms DESC; @@ -106,7 +107,7 @@ def __(chinook, mo, track): @app.cell(hide_code=True) -def __(mo): +def _(mo): mo.md( f""" You can explore the schemas of all your tables at a glance in the **data sources panel**: click diff --git a/examples/sql/misc/database_explorer.py b/examples/sql/misc/database_explorer.py index a2bd409f7c3..fcc1b544c5b 100644 --- a/examples/sql/misc/database_explorer.py +++ b/examples/sql/misc/database_explorer.py @@ -3,7 +3,8 @@ # dependencies = [ # "duckdb==1.1.1", # "marimo", -# "pandas==2.2.3", +# "polars==1.18.0", +# "pyarrow==18.1.0", # ] # /// diff --git a/examples/sql/misc/electric_vehicles.py b/examples/sql/misc/electric_vehicles.py index d3b450c4b46..a029b1bba54 100644 --- a/examples/sql/misc/electric_vehicles.py +++ b/examples/sql/misc/electric_vehicles.py @@ -2,7 +2,10 @@ # requires-python = ">=3.9" # dependencies = [ # "altair==5.4.1", +# "duckdb==1.1.3", # "marimo", +# "polars==1.18.0", +# "pyarrow==18.1.0", # ] # /// diff --git a/examples/sql/misc/sql_cars.py b/examples/sql/misc/sql_cars.py index a1856897702..e20565efd05 100644 --- a/examples/sql/misc/sql_cars.py +++ b/examples/sql/misc/sql_cars.py @@ -4,7 +4,8 @@ # "altair==5.4.1", # "duckdb==1.1.1", # "marimo", -# "pandas==2.2.3", +# "polars==1.18.0", +# "pyarrow==18.1.0", # "vega-datasets==0.9.0", # ] # /// @@ -233,11 +234,10 @@ def __(cars, mo, selected_cars): @app.cell def __(): import marimo as mo - import pandas as pd import duckdb import altair as alt from vega_datasets import data - return alt, data, duckdb, mo, pd + return alt, data, duckdb, mo if __name__ == "__main__": diff --git a/examples/sql/parametrizing_sql_queries.py b/examples/sql/parametrizing_sql_queries.py index 130b6669bfe..4900d790bc3 100644 --- a/examples/sql/parametrizing_sql_queries.py +++ b/examples/sql/parametrizing_sql_queries.py @@ -3,7 +3,8 @@ # dependencies = [ # "duckdb==1.1.1", # "marimo", -# "pandas==2.2.3", +# "polars==1.18.0", +# "pyarrow==18.1.0", # "vega-datasets==0.9.0", # ] # /// diff --git a/examples/sql/querying_dataframes.py b/examples/sql/querying_dataframes.py index e60055ba313..01c2c2939c8 100644 --- a/examples/sql/querying_dataframes.py +++ b/examples/sql/querying_dataframes.py @@ -3,7 +3,8 @@ # dependencies = [ # "duckdb==1.1.1", # "marimo", -# "pandas==2.2.3", +# "polars==1.18.0", +# "pyarrow==18.1.0", # "vega-datasets==0.9.0", # ] # /// diff --git a/examples/sql/read_csv.py b/examples/sql/read_csv.py index 4a818546457..f6d94bf1d39 100644 --- a/examples/sql/read_csv.py +++ b/examples/sql/read_csv.py @@ -3,19 +3,20 @@ # dependencies = [ # "duckdb==1.1.1", # "marimo", -# "pandas==2.2.3", +# "polars==1.18.0", +# "pyarrow==18.1.0", # "vega-datasets==0.9.0", # ] # /// import marimo -__generated_with = "0.9.1" +__generated_with = "0.10.7" app = marimo.App(width="medium") @app.cell(hide_code=True) -def __(mo): +def _(mo): mo.md( """ # Read CSV @@ -27,22 +28,22 @@ def __(mo): @app.cell(hide_code=True) -def __(): +def _(): import marimo as mo - import pandas as pd + import polars as pl - pd.DataFrame({"A": [1, 2, 3], "B": ["a", "b", "c"]}).to_csv("data.csv") - return mo, pd + pl.DataFrame({"A": [1, 2, 3], "B": ["a", "b", "c"]}).write_csv("data.csv") + return mo, pl @app.cell(hide_code=True) -def __(mo): +def _(mo): mo.md("""Reading from a local CSV is as easy as `SELECT * from "data.csv"`, where `data.csv` is the path to your local file (or a URL to a CSV file).""") return @app.cell(hide_code=True) -def __(mo): +def _(mo): mo.accordion( { "Tip: Creating SQL Cells": mo.md( @@ -62,19 +63,20 @@ def __(mo): @app.cell -def __(data, mo): +def _(mo): result = mo.sql( f""" -- Tip: you can also specify the data files using a glob, such as '/path/to/*.csv' -- or '/path/**/to/*.csv' SELECT * FROM "data.csv" - """, output=False + """, + output=False, ) return (result,) @app.cell(hide_code=True) -def __(mo): +def _(mo): mo.accordion( { "Tip: Query output": mo.md( @@ -92,13 +94,13 @@ def __(mo): @app.cell -def __(result): +def _(result): result return @app.cell(hide_code=True) -def __(mo): +def _(mo): mo.md( r""" ## Create an in-memory table from a CSV file @@ -110,7 +112,7 @@ def __(mo): @app.cell -def __(data, mo): +def _(mo): _df = mo.sql( f""" CREATE TABLE myTable AS SELECT * FROM "data.csv" @@ -120,7 +122,7 @@ def __(data, mo): @app.cell -def __(mo, myTable): +def _(mo, myTable): _df = mo.sql( f""" SELECT * FROM myTable @@ -130,13 +132,13 @@ def __(mo, myTable): @app.cell(hide_code=True) -def __(mo): +def _(mo): mo.md(r"""## Advanced usage""") return @app.cell(hide_code=True) -def __(mo): +def _(mo): mo.md(r"""To customize how your CSV is read, including specifying the delimiter type, use [duckdb's `read_csv` function](https://duckdb.org/docs/data/csv/overview.html).""") return diff --git a/examples/sql/read_json.py b/examples/sql/read_json.py index 13f7be1377a..9162672ad70 100644 --- a/examples/sql/read_json.py +++ b/examples/sql/read_json.py @@ -3,20 +3,20 @@ # dependencies = [ # "duckdb==1.1.1", # "marimo", -# "pandas==2.2.3", -# "pyarrow==17.0.0", +# "polars==1.18.0", +# "pyarrow==18.1.0", # "vega-datasets==0.9.0", # ] # /// import marimo -__generated_with = "0.9.1" +__generated_with = "0.10.7" app = marimo.App(width="medium") @app.cell(hide_code=True) -def __(mo): +def _(mo): mo.md( """ # Read JSON @@ -28,16 +28,16 @@ def __(mo): @app.cell(hide_code=True) -def __(): +def _(): import marimo as mo - import pandas as pd + import polars as pl - pd.DataFrame({"A": [1, 2, 3], "B": ["a", "b", "c"]}).to_json("data.json", orient="records") - return mo, pd + pl.DataFrame({"A": [1, 2, 3], "B": ["a", "b", "c"]}).write_json("data.json") + return mo, pl @app.cell(hide_code=True) -def __(mo): +def _(mo): mo.md( """ Reading from a JSON file is as easy as @@ -53,7 +53,7 @@ def __(mo): @app.cell(hide_code=True) -def __(mo): +def _(mo): mo.accordion( { "Tip: Creating SQL Cells": mo.md( @@ -73,19 +73,20 @@ def __(mo): @app.cell -def __(data, mo): +def _(mo): result = mo.sql( f""" -- Tip: you can also specify the data files using a glob, such as '/path/to/*.json' -- or '/path/**/to/*.json' SELECT * FROM 'data.json' - """, output=False + """, + output=False, ) return (result,) @app.cell(hide_code=True) -def __(mo): +def _(mo): mo.accordion( { "Tip: Query output": mo.md( @@ -103,13 +104,13 @@ def __(mo): @app.cell -def __(result): +def _(result): result return @app.cell(hide_code=True) -def __(mo): +def _(mo): mo.md( r""" ## Create an in-memory table from a JSON file @@ -121,7 +122,7 @@ def __(mo): @app.cell -def __(data, mo): +def _(mo): _df = mo.sql( f""" CREATE OR REPLACE TABLE myTable AS SELECT * FROM 'data.json' @@ -131,7 +132,7 @@ def __(data, mo): @app.cell -def __(mo, myTable): +def _(mo, myTable): _df = mo.sql( f""" SELECT * FROM myTable @@ -141,13 +142,13 @@ def __(mo, myTable): @app.cell(hide_code=True) -def __(mo): +def _(mo): mo.md(r"""## Advanced usage""") return @app.cell(hide_code=True) -def __(mo): +def _(mo): mo.md(r"""To customize how your json file is read, use [duckdb's `read_json` function](https://duckdb.org/docs/data/json/overview.html).""") return diff --git a/examples/sql/read_parquet.py b/examples/sql/read_parquet.py index a39cb211d50..3f7da999613 100644 --- a/examples/sql/read_parquet.py +++ b/examples/sql/read_parquet.py @@ -3,8 +3,8 @@ # dependencies = [ # "duckdb==1.1.1", # "marimo", -# "pandas==2.2.3", -# "pyarrow==17.0.0", +# "polars==1.18.0", +# "pyarrow==18.1.0", # "vega-datasets==0.9.0", # ] # /// @@ -30,10 +30,10 @@ def __(mo): @app.cell(hide_code=True) def __(): import marimo as mo - import pandas as pd + import polars as pl - pd.DataFrame({"A": [1, 2, 3], "B": ["a", "b", "c"]}).to_parquet("data.parquet") - return mo, pd + pl.DataFrame({"A": [1, 2, 3], "B": ["a", "b", "c"]}).write_parquet("data.parquet") + return mo, pl @app.cell(hide_code=True)