`dlt_load_id` in Generated SQL Doesn't Match dlt Tables
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
-
After running the dlt pipeline, run the command:
sqlmesh init -t dlt --dlt-pipeline bluesky duckdb -
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
- Tutorial used: SQLMesh dlt Pipeline Tutorial
- Related blog post: dlt-SQLMesh Metadata Handover
- Documentation: SQLMesh dlt Integration
Additional Notes
This issue seems to relate to improper handling of child tables during SQL generation.
In the database in table, followers__labels
In code there is dlt_load_id, originally not in DB
Thanks for the detailed description in the issue @dat-a-man opened a pr with support for nested dlt tables