Skip to content

Upgrade to sqlglot >=30 compatibility#72

Open
nvictus wants to merge 1 commit intomainfrom
feat/sqlglot-30-compat
Open

Upgrade to sqlglot >=30 compatibility#72
nvictus wants to merge 1 commit intomainfrom
feat/sqlglot-30-compat

Conversation

@nvictus
Copy link
Copy Markdown
Member

@nvictus nvictus commented Mar 25, 2026

Summary

  • Adapts GIQL's custom expression classes to sqlglot 30.x's new class hierarchy (Expr vs Expression split)
  • Updates Parser.expression() calls in the dialect to pass pre-constructed instances (new API)
  • Pins sqlglot >=30.0.0

Details

sqlglot 30.x made Expr a base trait where _set_parent raises NotImplementedError. Concrete classes must inherit from both Expression (which implements _set_parent, __init__, etc.) and their trait class (Binary, Func). This mirrors how sqlglot's own classes are defined (e.g., class Add(Expression, Binary)).

Affected classes: SpatialPredicate, GIQLCluster, GIQLMerge, GIQLDistance, GIQLNearest.

Test plan

  • All 151 existing tests pass against sqlglot 30.0.3

sqlglot 30.x split the expression hierarchy: Expr is now a base trait
with _set_parent raising NotImplementedError, while Expression is the
concrete class that implements it. Trait classes (Binary, Func) inherit
from Expr, so custom expression classes must now inherit from both
Expression and their trait class. Additionally, Parser.expression() now
expects a pre-constructed instance instead of class + kwargs.

Changes:
- Add exp.Expression to SpatialPredicate, GIQLCluster, GIQLMerge,
  GIQLDistance, and GIQLNearest base classes
- Construct expression instances before passing to self.expression()
  in the parser
- Pin sqlglot >=30.0.0
@nvictus nvictus requested a review from conradbzura March 25, 2026 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant