datacontract-cli icon indicating copy to clipboard operation
datacontract-cli copied to clipboard

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

Open dwelden opened this issue 11 months ago • 1 comments

Snowflake SQL script has a CREATE TABLE dbs.schema.table, but the generated YAML reports errors on missing account, database, and schema. Account I understand, but database and schema are present and should be included in the servers section.

dwelden avatar Feb 20 '25 17:02 dwelden

Looking at the code in sql_importer.py, it appears that this would be the required SQLGlot code to pick up database and schema:

for table in tables:
    ...
    table_name = table.this.name
    database_name = table.catalog
    schema_name = table.db

dwelden avatar Feb 20 '25 21:02 dwelden