Repository navigation
Conversation
…a dialect config Grammar parsing, Walk, Renderer, the derivation, the submissions, the named definitions and the obligation and case builders take a DialectConfig instead of reading module globals a dialect sets. shared_config() holds the shared defaults; Walk.operand_class and Renderer.reserved_word give a dialect's subclass the one place it changes them.
…ng it sqlite_config() returns the shared config with the SQLite tokens, operand classes, styles and root readers, where install() set them on the shared modules.
…ng it duckdb_config() returns the shared config with the DuckDB tokens, operand classes, styles and root readers, where install() set them on the shared modules.
…stalling it postgres_config() returns the shared config with the PostgreSQL tokens, operand classes, styles and root readers, where install() set them on the shared modules.
…installing it clickhouse_config() returns the shared config with the ClickHouse tokens, classes, cased names, styles and readers. ClickHouseWalk classes operands as each form's page does and names a number as the wrong fill for a name, for its own forms only, where install() swapped the shared walk's globals around every token; ClickHouseRenderer accepts a keyword in place of a name.
…installing it databricks_config() returns the shared config with the Databricks tokens, classes, styles and readers. Its Walk and Renderer subclasses carry what install() patched onto the shared classes: the page's operand classes, reserved-word specs, backticked identifiers, the reserved word an alias takes (now set on the case's own renderer, not swapped on the module), and a dropped `(` dropping its `)`.
…alling it bigquery_config(root) returns the shared config with the BigQuery tokens, classes, styles and readers, and the Withdrawals its suppression hook fills. A form's FORM_CLASS_RULES go first in a config derived for that form alone, where install() swapped the shared class rules around it.
…stalling it snowflake_config() returns the shared config with Snowflake's number token, cased words, templates, repeated items, fill and bare-value classes, clause callees, mixed-case quoting, one written option and widened integer rule, where install() set each on the shared modules.
Every builder, cases module and test that called a dialect's install() now builds that dialect's config once and passes it to family_obligations, submissions, style_of and derive_trees.
…s the shared modules With every dialect building its own config, nothing sets or changes the shared grammar-obligations modules, so the snapshot-and-restore guard, its decorators and the BigQuery tests' fixture go. Databricks and Snowflake leave strict xfail: all seven dialects build forward and in reverse in one process with no stale file. A static check finds any global statement, and any set, delete, setattr or in-place change of a name imported from the shared package, and a test runs it over every module under scripts/ and tests/.
…pter styles in a loop The grammar readers that take a config take every argument by name, DialectConfig's walk and renderer types come from types.py, and each adapter builds its family styles in a loop instead of a nested comprehension.
…ons, which carry a line
Contributor
Author
|
Independent review at 35d35d4: the refactor is correct. Changes requested only on the scanner. Behaviour
Config against install()
Scanner (requested)
Merge order: this conflicts with #530 in |
…s and freeze the tables install() wrote The scan now counts an augmented assignment to an imported shared name, unpacks tuple, list and starred targets, and knows popitem, discard, sort, reverse, the set update methods and the in-place dunders. The family styles, repeat fills and both wrong-fill tables are read-only mappings, so a write through an alias the scan cannot see fails when it runs.
Contributor
Author
|
Fixes-only check at d477823: approved. The scanner findings are fixed.
|
kvlonge
added this pull request to the merge queue
Dec 6, 2026
Any commits made after this event will not be merged.
This branch has not been deployed
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
Each dialect's obligation build used to
install()its rules by setting names on the shared grammar-obligations modules, so one dialect's build could change another's output in the same process. #528 snapshotted and restored those modules around each build; Databricks and Snowflake still ran without it. This removes the shared state instead of guarding it.Changes
DialectConfigholds whatinstall()used to set: token, class rules, templates, list and fill rules, family styles, the walk and renderer classes, and the root readers. The grammar reader, walk, renderer, derive, obligations and cases code take it asconfig.sqlite_config(), ...,bigquery_config(root)); the builders, cases modules and tests build it once and pass it down.globaland any set, delete,setattr, augmented or in-place change of a name imported from the shared package; a test runs it overscripts/andtests/(none found; on main it finds 75 across the seven adapters). The tablesinstall()wrote are read-only mappings, so a write through an alias fails at run time.Verification
Each builder's written obligations and cases, hashed on main a2e871d (with #529, #530 and #531) and on this branch merged with it, run with
--check(0 stale):Targeted pytest over grammar_obligations and the seven syntax_obligations suites: 273 passed, no xfail.
fensu check: 0 faults.