fix: take the sql import server's database and schema from the table name - #1528
Open
ReguiguiMohamed wants to merge 1 commit into
Open
fix: take the sql import server's database and schema from the table name#1528ReguiguiMohamed wants to merge 1 commit into
ReguiguiMohamed wants to merge 1 commit into
Conversation
…name (datacontract#651) import_sql parsed the catalog and schema of a qualified CREATE TABLE and then dropped them, so every generated server block carried the my_database and my_schema placeholders. They now come from the created tables, for the server types where a qualified name means database.schema. The placeholders stay when the DDL names no location, when two created tables sit in different places, and when the name carries a substituted ${var} token, since none of those identify one server.
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.
datacontract import sqlparsed the catalog and schema of a qualifiedCREATE TABLEand then dropped them, so the generatedserversblock always carried themy_databaseandmy_schemaplaceholders. They now come from the created tables.The placeholders stay where the DDL identifies no single server: no qualifier, two created tables in different places, or a name carrying a substituted
${var}token. OnlyCREATE TABLEcounts, so a query source in a CTAS or aCREATE VIEWtarget cannot supply the location.This applies to snowflake, sqlserver, postgres and redshift, where a qualified name means database.schema. On mysql, oracle, bigquery and databricks the parts mean something else and belong in other server fields, so their DDL is left to the placeholders.
Closes #651
uv run pytest)uv run ruff check --fix && uv run ruff format)