cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

i have created a materialized view table using delta live table pipeline and its not appending data

zero234
New Contributor III
i have created a materialized view table using delta live table pipeline , for some reason it is overwriting data every day , i want it to append data to the table instead of doing full refresh suppose i had 8 million records in table and if i
run the pipeline it will remove those previous records and only put in new records. i want it to appends to already existing data i have tried using @Dlt.table(merge Mode="append")it throws unexpected keyword argument error
i have tried using @Dlt.table(merge Mode="append")it throws unexpected keyword argument error
what to do so my pipeline appends data 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Kaniz
Community Manager
Community Manager

Hi @zero234., To ensure that your Delta Live Table pipeline appends data instead of overwriting it, you can use the @append_flow decorator.

Here are the steps:

  1. Use @append_flow:

  2. Define Materialized Views or Streaming Tables:

  3. Example Usage:

    from deltatables import Dlt
    
    @Dlt.table
    def my_materialized_view():
        # Your query here (e.g., SELECT * FROM my_source_data)
        pass
    
    @Dlt.append_flow
    def my_streaming_pipeline():
        # Your streaming logic here
        pass
    
  4. Override Default Behavior:

 

View solution in original post

2 REPLIES 2

Kaniz
Community Manager
Community Manager

Hi @zero234., To ensure that your Delta Live Table pipeline appends data instead of overwriting it, you can use the @append_flow decorator.

Here are the steps:

  1. Use @append_flow:

  2. Define Materialized Views or Streaming Tables:

  3. Example Usage:

    from deltatables import Dlt
    
    @Dlt.table
    def my_materialized_view():
        # Your query here (e.g., SELECT * FROM my_source_data)
        pass
    
    @Dlt.append_flow
    def my_streaming_pipeline():
        # Your streaming logic here
        pass
    
  4. Override Default Behavior:

 

kulkpd
Contributor

@zero234 ,

Adding some suggestion based on answers from @Kaniz. Important point to note here: "To define a materialized view in Python, apply @table to a query that performs a static read against a data source. To define a streaming table, apply @table to a query that performs a streaming read against a data source."

I think if you which to read by streaming mode, DLT will treat your destination as streaming table.

 

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.