Repository navigation
fix(validation): degrade gracefully on sqlglot older than 30.19.0 - #780
Merged
christianeu-db merged 1 commit intoNov 21, 2026
Merged
christianeu-db merged 1 commit into
christianeu-db merged 1 commit into
Conversation
validate.py references exp.Agg, which sqlglot ships only from 30.19.0. Running the script with an older sqlglot already on the path (a plain `python validate.py` run rather than `uv run`) raised AttributeError mid-validation. Detect the too-old version at import, treat it as unavailable so the existing SQL-check guards skip cleanly, and emit one clear warning naming the required minimum instead of crashing. The two existing "sqlglot not installed" warnings are suppressed in that case, since the sqlglot is installed, only too old. Co-authored-by: Isaac <no-reply@databricks.com>
christianeu-db
force-pushed
the
fix-validate-sqlglot-agg-version-guard
branch
from
November 20, 2026 18:37
16a9a71 to
69ed8cf
Compare
christianeu-db
marked this pull request as ready for review
November 20, 2026 18:39
christianeu-db
requested review from
jbonofre and
kayemkim
and removed request for
kayemkim
November 20, 2026 19:24
kayemkim
approved these changes
Nov 21, 2026
kayemkim
left a comment
Member
There was a problem hiding this comment.
I ran this as plain python validation/validate.py against real sqlglot releases, since the test only patches the two flags. 30.18.0 and older releases back to 20.0.0 print the one warning and pass the examples where main stops with the AttributeError, and 30.19.0 runs the SQL checks as before. The ontology and mapping documents get the same single warning. LGTM.
4 tasks done
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.
Summary
validation/validate.pyreferencesexp.Agg, a sqlglot expression class thatexists only in sqlglot >= 30.19.0 (added together with the
AGG()supportin #703 / #726). The script's inline metadata pins that minimum, so
uv runworks. However, running the script as a plain
python validation/validate.py <file>uses whatever sqlglot is already on the path. An older sqlglot importscleanly (
SQLGLOT_AVAILABLE = True), then crashes mid-validation at the firsttree.find_all(exp.Agg):This PR makes the validator degrade gracefully instead of crashing, matching
the existing behavior for when sqlglot is not installed at all:
not hasattr(exp, "Agg")) and treat itas unavailable, so every existing
not SQLGLOT_AVAILABLEguard skips the SQLchecks.
ValidationWarninginvalidate_documentnaming theinstalled version, the required minimum, and an upgrade hint.
since the sqlglot is installed, only too old.
No behavior change for the supported configuration (sqlglot >= 30.19.0).
Related Issues
Checklist
Validation
Tests
pytest/ CI green)This pull request and its description were written by Isaac.