sqlmesh icon indicating copy to clipboard operation
sqlmesh copied to clipboard

`dlt_load_id` in Generated SQL Doesn't Match dlt Tables

Open dat-a-man opened this issue 1 year ago • 1 comments

I’m working on generating SQLmesh SQL code from a dlt (BlueSky) pipeline using the command:

sqlmesh init -t dlt --dlt-pipeline bluesky duckdb

However, I noticed an issue. SQLmesh generates SQL that includes dlt_load_id in all four tables, but in the dlt pipeline, dlt_load_id is only present in one table.

Steps to Reproduce

  1. After running the dlt pipeline, run the command:

    sqlmesh init -t dlt --dlt-pipeline bluesky duckdb
    
  2. Inspect the generated SQL code for the tables.

Expected Behavior
dlt_load_id should only be present in the table where it exists in the dlt pipeline.

Actual Behavior
dlt_load_id is included in all tables generated by SQLmesh.

References

Additional Notes
This issue seems to relate to improper handling of child tables during SQL generation.


In the database in table, followers__labels Screenshot 2024-12-20 at 8 49 51 AM

In code there is dlt_load_id, originally not in DB Screenshot 2024-12-20 at 8 50 52 AM

dat-a-man avatar Dec 20 '24 03:12 dat-a-man

Thanks for the detailed description in the issue @dat-a-man opened a pr with support for nested dlt tables

themisvaltinos avatar Dec 20 '24 11:12 themisvaltinos