Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago

Microsoft Fabric - Synapse Warehouse - DDL Script Generation

Hi Team,

 

Once we create a table in the Database, then we can able to DESCRIBE the table in the query window using DESC command or we can generate the CREATE SQL or get the table DDL script from Metadata tables for already created tables in the database.

 

Sameway I am trying to get the DDL script, But not able to find the option in Microsoft Fabric Warehouse.

DESC --> not working in Fabric Warehouse
Tried below SQL, but not getting the expected DDL for the table

SELECT sm.definition
FROM sys.sql_modules AS sm
JOIN sys.objects AS o ON sm.object_id = o.object_id
WHERE o.name = 'TableName';


Can you suggest the option if anything available in Microsoft Fabric Warehouse.

Regards,

Sathish Kumar Mathivanan

 

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous,

    AFAIK, the DESCRIBE current only work when you use notebook to operate with lakehouse delta table. For data warehouse tables, they seems not able to used with DESCRIBE commands. 

    Perhaps you can try to move this to the lakehouse and use notebook with these commands.

    Regards,
    Xiaoxin Sheng

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi,

       

      We can't move the solution to Lakehouse. 

      Other than DESCRIBE, Do we have any other option like any metadata tables contains the DDL ?

       

      Regards,

      Sathish Kumar Mathivanan

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Anonymous,

        I'd like to suggest you use query to list the views under the schema: INFORMATION_SCHEMA.TABLES/INFORMATION_SCHEMA.COLUMNS, they should include the metadata fields that you wanted.

        Notice: you query records from these schema but currently you not have permission to view and query data from some sys table/views.

        Regards,

        Xiaoxin Sheng