Repository navigation
fix: resolve qualified table names against the schema - #110
Merged
Merged
Conversation
A relation may be declared as TABLE, SCHEMA.TABLE or DATABASE.SCHEMA.TABLE, and a written name reads the declared relation whose parts agree with it, completed by the session's DATABASE and SCHEMA. The converted SQL names the relation as declared. Ambiguous, CTE-captured and doubly read names refuse with SQ0004 naming the candidates. census links a qualified reference to the model file named by its last part.
Contributor
Author
|
Local D94 gate on head be64daa (base main 9ad7d1c):
Main has since moved to e9f002d, which merges cleanly. I'll merge main again and re-gate before landing, after slice 2. |
Contributor
Author
|
D94 gate on c3555dd (main 464e7bb merged in, clean merge):
|
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
dbt's compiled SQL always names relations as
database.schema.table. Every qualified name was refused with SQ0002node:table, sosqlquack census target/compiled/..., the census example in the docs, reported nearly every real model as refused.Changes
TABLE,SCHEMA.TABLEorDATABASE.SCHEMA.TABLE. A written name, resolved as Snowflake does (unquoted parts upper-case, quoted parts keep their case), reads the declared relation whose parts agree with it, read backwards from the table name. The longest agreement wins. The converted SQL names the relation as declared, so it binds in a DuckDB database attached under that name.DATABASEandSCHEMA(--session, or the Pythonsession=) complete names written without them.--chain-modelsand its blocker graph link a qualified reference to the model file named by its last part.Verification
make check-ci,make test-rust,make verify-recorded.