update default duckdb mo.sql deps#9599
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
No issues found across 4 files
Architecture diagram
sequenceDiagram
participant User
participant mo_sql as mo.sql()
participant DepManager as DependencyManager
participant Config as runtime config
participant DuckDB as DuckDB engine
Note over User,DuckDB: NEW: Bundled dependency resolution
User->>mo_sql: sql(query)
mo_sql->>Config: get_configured_sql_output_format()
Config-->>mo_sql: "auto" | "pandas" | "polars" | "lazy-polars" | "native"
mo_sql->>mo_sql: _default_duckdb_deps()
Note over mo_sql: Always require duckdb + sqlglot
alt sql_output == "auto"
alt polars or pandas already installed
mo_sql->>mo_sql: Skip dataframe library
else neither installed
mo_sql->>mo_sql: Add polars[pyarrow]
end
else sql_output == "pandas"
mo_sql->>mo_sql: Add pandas
else sql_output == "polars" or "lazy-polars"
mo_sql->>mo_sql: Add polars[pyarrow]
else sql_output == "native"
mo_sql->>mo_sql: No dataframe library needed
end
mo_sql->>DepManager: require_many(bundled_deps)
alt All deps available
DepManager-->>mo_sql: OK
mo_sql->>DuckDB: DuckDBEngine(connection=None)
DuckDB-->>mo_sql: Execute query
mo_sql-->>User: Result (DataFrame/Relation)
else Missing deps
DepManager-->>mo_sql: ManyModulesNotFoundError
Note over DepManager: Single error listing all missing packages
mo_sql-->>User: Installation prompt once
end
There was a problem hiding this comment.
Pull request overview
When mo.sql(...) is called with the default DuckDB engine, the previous code only required duckdb + sqlglot upfront and later triggered a second prompt to install a dataframe library (polars/pandas). This PR bundles the dataframe library into the initial dependency check based on the configured sql_output format so users get a single install prompt.
Changes:
- Added
_resolve_default_duckdb_depsinmarimo/_sql/sql.pyto compute the full default dep list based onSqlOutputType, and use it insql(). - Extracted
get_configured_sql_output_format()helper intomarimo/_sql/utils.pyand reused it inmarimo/_sql/engines/types.py. - Added unit and end-to-end tests, and patched
get_configured_sql_output_formatintest_get_engines.pyto avoid triggering the new dep-bundling.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| marimo/_sql/sql.py | Adds dep-resolution helpers and uses them in sql() to prompt for all needed packages at once. |
| marimo/_sql/utils.py | New get_configured_sql_output_format() shared helper. |
| marimo/_sql/engines/types.py | Uses the new shared helper instead of inlining context lookup. |
| tests/_sql/test_sql.py | New tests for _resolve_default_duckdb_deps and end-to-end bundled error. |
| tests/_sql/test_get_engines.py | Patches get_configured_sql_output_format to "native" to skip dataframe-lib check. |
|
nice, this is a great improvement |
|
🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.23.7-dev58 |
📝 Summary
When you run mo.sql with duckdb from a fresh engine, it prompts you to install
duckdb, andsqlglot, and then after running, prompts to install polars/pandas.This now gets you to install all 3 packages from the start.

📋 Pre-Review Checklist
✅ Merge Checklist