fix: SQL quality rule placeholders quoted per dialect, parse errors clearer (#1653) - #1660
Merged
Merged
Conversation
…learer (#1653) - Backticks around a placeholder now force quoting in the server's dialect, so reserved words like {join} work on Spark/Databricks. - Names with dialect-specific safe characters (e.g. $ on Snowflake) stay bare, matching behavior on main. - Parse error messages show "Incomplete expression" instead of sqlglot internals. - Single-pass placeholder substitution prevents double-substitution of nested placeholder-like text. - New tests cover backtick quoting, safe-character names, and parse error detail.
jschoedl
marked this pull request as ready for review
September 25, 2026 08:54
- Drop column numbers from parse-error messages (line + token is clearer; columns shift by placeholder-substitution length differences) - Simplify generic 'not read-only' refusal message: remove dialect name since this path only fires for multi-statement or non-SELECT queries that already parse successfully - Rename sqlglot_dialect() to sqlglot_dialect_by_name() to avoid collision with same name in native_type.py (calls from ibis_check_execute.py use the latter)
Use databricks instead of local server to test that amount$usd gets quoted. The bare-name regex behaves differently across sqlglot versions (30.17 accepts $ in DuckDB names, 28.10 doesn't), but Databricks's tokenizer has no extra name chars in either version, so the assertion stays consistent. The Snowflake assertion (which leaves the name bare) is unchanged.
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.
SQL quality rule placeholders are now quoted in the server's dialect when a name needs it (e.g. a column with a space), and a query that doesn't parse reports the parse error instead of a generic refusal.
Fixes #1653