Repository navigation
Conversation
Compiled query_sql keeps relation markers such as __ref("orders"). Snowflake
does not accept a bare function call in FROM, so newer SQLQuack parsers refuse
every Snowflake model that references another.
A shared helper in sqlbuild-analysis (relation_markers::markers_as_names) now
writes each marker call in code as a short indexed name, padded so all later
text keeps its line and column, and returns the calls by index. sql_tree reads
SQL through it for every dialect. The rules crate's dialect lexical syntax moves
to sqlbuild-sqltext so both use one mapping.
This was referenced Nov 8, 2026
Contributor
Author
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.
Why
Compiled
query_sqlkeeps relation markers such as__ref("orders"). Snowflake does not accept a bare function call inFROM, and newer SQLQuack Snowflake parsers refuse it too ("Expected TABLE( ) around a table function"). Custom-rule syntax trees (SqlDocument) over Snowflake models with references would then fail, as would the compile benchmark's statistics, which read the same trees. This must land before a newer SQLQuack pin.Changes
sqlbuild_analysis::relation_markers::main::markers_as_names. It writes each marker call in code as__sqb_<index>, padded with spaces and the call's own line breaks so later text keeps its line and column. It returns the calls (function, name) by index. Calls in comments and quoted text are left alone. It starts from the SQL-test planning template's helper, so both share one reading.sql_tree_nodes, and soSqlDocument, parses through it for every dialect. Marker calls now read as table nodes rather than function calls.sqlbuild_sqltext::sql_scan::main::dialect_lexical_syntax, so query facts and syntax trees share one mapping.Verification
__dbt_ref, calls left alone. A Snowflakesql_treecase puts nodes after markers on the same line.__ref, throughsqb compile.sql_treecase fails with the error above; with it, it passes. The E2E andSqlDocumenttests pass (9/9). The varied 1,000-model statistics match the current pin: 999 shapes, 175 array models, 340 window models.make check-ciDuckShop: no new case. Its models already use
__ref/__source; the gap was the Snowflake tree parse, covered by the unit and E2E cases.