Repository navigation
Conversation
Local scenario capture no longer asks Polyglot to read warehouse column types. Postgres types go through sqlquack-syntax-postgres's type parser, and Snowflake and BigQuery types through their SQLQuack cast-target parse, behind one native function (parse_warehouse_type). DuckDB and MotherDuck spellings pass through unchanged. Databricks nested types map recursively to DuckDB's LIST, MAP and STRUCT, and a nested spelling that cannot be mapped is refused with a named message instead of falling back to JSON. Other types keep their integer width or fall back to VARCHAR.
Contributor
Author
|
Before/after type mapping for every dialect and type pair in the scenario capture tests (Polyglot on main vs SQLQuack here). 13 of 116 rows change.
|
SQL Server has no SQLQuack type parser, so its information_schema names reached the generic fallback, which held datetime2, smalldatetime, datetimeoffset and uniqueidentifier as VARCHAR. A SQL Server pre-mapper now maps them to TIMESTAMP, TIMESTAMPTZ and UUID, bit to BOOLEAN, money and smallmoney to exact decimals, and SQL Server's 8-byte float to DOUBLE. The fallback keeps 4-byte floats (FLOAT, FLOAT4, REAL) as FLOAT instead of widening them to DOUBLE. A panic in the warehouse type parser now surfaces as the ValueError capture already falls back on.
Contributor
Author
|
Before/after type mapping at 7655ef3: every dialect and type pair in the capture tests, plus the SQL Server information_schema names and the float spellings from review. Polyglot on base 97ab62c is compared with this branch. 31 of 156 rows change; the T-SQL datetime2, smalldatetime, datetimeoffset and uniqueidentifier rows keep their timestamp and uuid types, so they don't appear as changes.
|
kvlonge
enabled auto-merge (squash)
November 8, 2026 04:57
…d-local-sql # Conflicts: # crates/sqlbuild-analysis/src/lib.rs
This was referenced Nov 8, 2026
SQLQuack's next commit refuses a bare call in a Snowflake FROM clause, which rejects the __ref and __source placeholders that compiled model SQL keeps, so custom-rule syntax trees fail on Snowflake models. This rev keeps the BigQuery parser the warehouse type parsers need.
kvlonge
disabled auto-merge
November 8, 2026 10:03
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
Scenario capture still asked Polyglot (
parse_data_type) to read warehouse column types. This replaces it with SQLQuack's type parsers, one of the last two runtime uses of the Polyglot package.Changes
parse_warehouse_type(spelling, dialect). Postgres usessqlquack-syntax-postgres; Snowflake and BigQuery use the cast target ofCAST(NULL AS <type>). Other dialects returnNone.columns.py:_local_type_with_polyglotand its four helpers are replaced by a walk of the SQLQuack tree. DuckDB and MotherDuck spellings pass through unchanged.ARRAY/MAP/STRUCTmap recursively to DuckDBT[],MAP(K, V)andSTRUCT(a T). An unmappable element is refused withX605instead of becoming JSON. SQL Server's date, time, uuid, bit and money types get their own pre-mapper. The fallback keeps integer and 4-byte float widths and contains no Polyglot.4d0c6bc5→98eefae6, andsqlquack-syntax-bigqueryis added. Fingerprints are unchanged because the tokenizer and scanner sources are identical. The next SQLQuack commit refusesFROM __ref(...)placeholders on Snowflake, so this rev stops before it.import_polyglot.pyis deleted. The local-SQL path and the dependency drop follow separately.Verification
INTEGER→BIGINT(INT64), SnowflakeVARIANT→JSON, DuckDB spellings passing through, and SQL Server types that were invalid in DuckDB.cargo clippy -D warnings,cargo fmt, ruff, ty, fensu, and the native stub, boundary and layering checks pass.