cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Updating a streaming table in dlt

ashraf1395
Valued Contributor

Can we update a streaming table in dlt my source and target will be same. That is the update should be made on the same table. If yes then can you guide me how.

I tried append_flow but it just appends data

CDC I am not sure whether we can have both target and source table same there or not

1 REPLY 1

Walter_C
Databricks Employee
Databricks Employee

You can define the CDC flow to update the streaming table. This involves reading from the same table and applying changes.

@Dlt.table(
    name="my_streaming_table",
    comment="This table is updated using CDC",
    table_properties={"quality": "silver"}
)
@dlt.expect_or_drop("valid_data", "column_name IS NOT NULL")
def update_table():
    source_df = dlt.read_stream("my_streaming_table")
    changes_df = source_df.filter("change_type = 'update'")

    return changes_df

Ensure your pipeline is configured to use the CDC functionality. This can be done in the pipeline settings.

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.

Request a New Group