Guard SQL ref extraction on sqlglot availability#9656
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
No issues found across 3 files
Architecture diagram
sequenceDiagram
participant UI as Optional Features UI
participant App as App Config
participant Cell as Cell Visitor
participant Deps as DependencyManager
participant Pkg as Package Manager
participant Sqlglot as sqlglot library
Note over UI,Sqlglot: SQL Reference Extraction Flow
UI->>App: Display optional features
App->>Deps: Check dependency availability
Deps->>Pkg: Check if sqlglot[c] is installed
alt sqlglot[c] is installed
Pkg-->>Deps: Available
Deps-->>App: sqlglot available
App-->>UI: Show SQL feature as enabled
else sqlglot[c] not installed
Pkg-->>Deps: Not found
Deps-->>App: sqlglot not available
App-->>UI: Show SQL feature as disabled with install hint
end
Note over Cell,Pkg: Cell Execution & Reference Extraction
Cell->>Deps: Check has_sqlglot
Deps-->>Cell: boolean result
opt sqlglot is available
Cell->>Sqlglot: find_sql_refs_cached(statement_sql)
Sqlglot-->>Cell: sql_refs list
loop For each ref
Cell->>Cell: Check if ref name in defined_names
alt Name not already defined
Cell->>Cell: _add_ref(name, sql_ref=ref)
end
end
end
Note over Cell,Pkg: When sqlglot is unavailable, extraction is skipped silently
Skip find_sql_refs when sqlglot isn't installed instead of raising ModuleNotFoundError, so SQL cells still parse defs via duckdb.
28b0121 to
7732813
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR makes SQL reference extraction resilient to sqlglot being absent, and updates install guidance to prefer the sqlglot[c] extra for better SQL parsing performance.
Changes:
- Update
DependencyManager.sqlglotto recommend installingsqlglot[c]instead of plainsqlglot. - Guard SQL reference extraction in the AST visitor so it is skipped (rather than raising) when
sqlglotisn’t installed. - Update the frontend “Optional Features” SQL dependency spec to
sqlglot[c].
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| marimo/_dependencies/dependencies.py | Changes the suggested install target for sqlglot to sqlglot[c]. |
| marimo/_ast/visitor.py | Skips find_sql_refs calls when sqlglot isn’t available. |
| frontend/src/components/app-config/optional-features.tsx | Updates the optional SQL feature dependency string to sqlglot[c]. |
dmadisetti
approved these changes
May 21, 2026
|
🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.23.7-dev89 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Skip find_sql_refs when sqlglot isn't installed instead of raising