Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
I saw in different examples the usage of two different decorators "@dlt.table" and "@dlt.create_table" but I could not find out which the correct one is. It works with both, also if the table does not exist when starting the DLT-pipeline.
Can anybody tell me which the correct one is and what the differences are?
In Databricks Delta Live Tables (DLT), both @dlt.table and @dlt.create_table decorators are used, but they serve slightly different purposes. Here's the distinction:
@dlt.table:
This decorator is used to define a Delta Live Table (DLT).
It declares a table schema and instructs DLT to track changes to that table.
You use @dlt.table when you want to work with an existing table and track its changes as part of your DLT pipeline.
In Databricks Delta Live Tables (DLT), both @dlt.table and @dlt.create_table decorators are used, but they serve slightly different purposes. Here's the distinction:
@dlt.table:
This decorator is used to define a Delta Live Table (DLT).
It declares a table schema and instructs DLT to track changes to that table.
You use @dlt.table when you want to work with an existing table and track its changes as part of your DLT pipeline.
โ03-08-202409:19 AM - last edited on โ03-08-202410:26 AM by Kaniz_Fatma
@Kaniz_Fatma , Are you suggesting that the first time a pipeline runs, the below decorator should be used:
@dlt.create_table
And the once the pipeline runs, the notebook should be edited to use this decorator:
@dlt.table
Connect with Databricks Users in Your Area
Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโt want to miss the chance to attend and share knowledge.
If there isnโt a group near you, start one and help create a community that brings people together.