Skip to content

fix: take the sql import server's database and schema from the table name - #1528

Open
ReguiguiMohamed wants to merge 1 commit into
datacontract:mainfrom
ReguiguiMohamed:fix/sql-import-qualified-server
Open

fix: take the sql import server's database and schema from the table name#1528
ReguiguiMohamed wants to merge 1 commit into
datacontract:mainfrom
ReguiguiMohamed:fix/sql-import-qualified-server

Conversation

@ReguiguiMohamed

@ReguiguiMohamed ReguiguiMohamed commented Aug 22, 2026

Copy link
Copy Markdown

datacontract import sql parsed the catalog and schema of a qualified CREATE TABLE and then dropped them, so the generated servers block always carried the my_database and my_schema placeholders. 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. Only CREATE TABLE counts, so a query source in a CTAS or a CREATE VIEW target 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

  • Tests pass (uv run pytest)
  • Code formatted (uv run ruff check --fix && uv run ruff format)
  • Docs updated (if relevant)
  • CHANGELOG.md entry added

…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Database and schema in Snowflake CREATE TABLE statement not picked up for servers section of YAML on import

1 participant