Repository navigation
Conversation
The old KustoKqlCompiler rendered a Select to SQL text and then patched that text with regular expressions. It dropped HAVING and DISTINCT, broke on series-limit joins, saved metrics and datasets with comments before let, and rewrote operators inside string literals (L1-L7 in HANDOFF.md). The new compiler walks the Select with visitor methods and emits a KQL pipeline: let for virtual tables (statements hoisted, comments dropped), join kind=inner (...) on $left.x == $right.x__ for Superset's series limit, summarize alias = agg() by alias = expr, where after summarize for HAVING with aggregates replaced by their aliases, distinct, explicit sort direction, take and serialize | where row_number() > n. Bind values are always inlined, so statement caching is off. Every statement shape Superset 6.1 builds for charts, datasets and filter values is covered by a unit test on the exact KQL and an integration test on the Kusto emulator that checks the numbers. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Superset builds the SQL Lab table preview as select * from
text(quote_schema(schema) + "." + quote(table)), i.e. ["events"].["T"].
The 3.x compiler converted that to database("events").["T"]; the 4.0.0
rewrite passed FROM text through verbatim, so every KQL table preview in
SQL Lab failed with SEM0139 "Failed to resolve expression". A text that is
nothing but [schema.]table is now rendered like a TableClause; any other
FROM text is still KQL and stays as written.
Checked on the Superset fork against the production Kusto cluster
(/api/v1/database/<id>/select_star) and on the emulator.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Release 4.0.0: the KQL compiler (
sqlalchemy_kusto/dialect_kql.py) is rewritten as an expression-tree walker instead of regex fixes over compiled SQL text. T-SQL dialect and dbapi are untouched.Full list of fixes and output changes —
CHANGELOG.md, section 4.0.0. Key ones:COUNT(col)→countif(isnotnull(col));LIKE '%x%'→contains_cs;ORDER BYwithout direction is explicitasc.FROMtext that is only a table name renders asdatabase("s").["t"](Superset SQL Lab table preview).kustokql+http://for the Kusto emulator;OFFSETsupport.Verification:
6.1-dodo) since 2026-09-24.Note: open PRs #51 and #52 touch the old
dialect_kql.pyand will need rework on top of this.After merge: tag
4.0.0on the merge commit,make release, GitHub release.🤖 Generated with Claude Code