You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SqlQuery should accept sqlglot exp.Expr (exp.Query isn't an exp.Expression in sqlglot 30) #56
pgdevkit.db.fetch.SqlQueryNoTemplate/SqlQuery use exp.Expression for sqlglot queries. In sqlglot 30 the class hierarchy is split: exp.Query (the base of Select, Union, Subquery, ...) is an exp.Expr but not an exp.Expression (issubclass(exp.Query, exp.Expression) is False, issubclass(exp.Query, exp.Expr) is True; a concrete Select is both).
Impact (found in the CCMT2 rollout): code that has an exp.Query-typed value (e.g. the return type of a query builder, or a Union) cannot pass it to fetch_all/fetch_one/fetch_scalar/execute/PostgresJsonResponse without failing pyright/ty; CCMT2 worked around it by rendering to text and passing that. Runtime is fine (_render only needs .sql(dialect=...) and .walk()).
Fix: widen the annotation to exp.Expr (it's the common base in sqlglot >= 30; check what the minimum supported sqlglot version offers, and fall back to exp.Expression on older ones if needed) and add a type-level test (or a runtime test with a Union) so it doesn't regress.
Claude Session: dd3520fe-363b-5088-ab76-5e87fad68be0
PR #57 is ready for review and CI is green: the sqlglot query annotation is now exp.Expr, so exp.Query values (Select/Union/Subquery) are accepted by fetch_all/fetch_one/fetch_scalar/execute/PostgresJsonResponse. Runtime tests cover Union/Subquery and nested Command/placeholder rejection. Version 0.15.2.
Activity
aersam commentedon Oct 9, 2026
Working on this in PR #57 (Claude session dd3520fe-363b-5088-ab76-5e87fad68be0).
aersam commentedon Oct 9, 2026
PR #57 is ready for review and CI is green: the sqlglot query annotation is now
exp.Expr, soexp.Queryvalues (Select/Union/Subquery) are accepted by fetch_all/fetch_one/fetch_scalar/execute/PostgresJsonResponse. Runtime tests cover Union/Subquery and nested Command/placeholder rejection. Version 0.15.2.