<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic DLT Pipeline - Overwrite except for one Append table in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/dlt-pipeline-overwrite-except-for-one-append-table/m-p/168925#M56009</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I am a junior engineer and I am working on a use case involving DLT pipelines that read from a csv source at regular intervals and populate tables based upon processing of this. In most cases, I'd like the table contents to be overwritten with the new data, however there is one table where I need to append the new data instead to create a historical view.&lt;/P&gt;&lt;P&gt;To put the situation in pseudocode:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import pipelines as dp

dp.table(name = "Table1") # Overwrite
def table1():
    return spark.read.csv(path_to_my_csv).do_some_simple_processing()

dp.table(name = "Table2") # Need to have this append rather than overwrite
def table2():
    return spark.read.table("Table1")&lt;/LI-CODE&gt;&lt;P&gt;I've looked and I don't think this is covered by any of the option flags in the table decorator. I've also seen streaming_table and append_flow as potentially recommended, however they seem to require the source itself to be streaming tables which I don't know if this is possible for my use case. Can I ask what the recommended way to achieve this outcome with declarative pipelines would be?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Thu, 17 Sep 2026 10:33:24 GMT</pubDate>
    <dc:creator>Melia-Taylour</dc:creator>
    <dc:date>2026-09-17T10:33:24Z</dc:date>
    <item>
      <title>DLT Pipeline - Overwrite except for one Append table</title>
      <link>https://community.databricks.com/t5/data-engineering/dlt-pipeline-overwrite-except-for-one-append-table/m-p/168925#M56009</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I am a junior engineer and I am working on a use case involving DLT pipelines that read from a csv source at regular intervals and populate tables based upon processing of this. In most cases, I'd like the table contents to be overwritten with the new data, however there is one table where I need to append the new data instead to create a historical view.&lt;/P&gt;&lt;P&gt;To put the situation in pseudocode:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import pipelines as dp

dp.table(name = "Table1") # Overwrite
def table1():
    return spark.read.csv(path_to_my_csv).do_some_simple_processing()

dp.table(name = "Table2") # Need to have this append rather than overwrite
def table2():
    return spark.read.table("Table1")&lt;/LI-CODE&gt;&lt;P&gt;I've looked and I don't think this is covered by any of the option flags in the table decorator. I've also seen streaming_table and append_flow as potentially recommended, however they seem to require the source itself to be streaming tables which I don't know if this is possible for my use case. Can I ask what the recommended way to achieve this outcome with declarative pipelines would be?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2026 10:33:24 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/dlt-pipeline-overwrite-except-for-one-append-table/m-p/168925#M56009</guid>
      <dc:creator>Melia-Taylour</dc:creator>
      <dc:date>2026-09-17T10:33:24Z</dc:date>
    </item>
    <item>
      <title>Re: DLT Pipeline - Overwrite except for one Append table</title>
      <link>https://community.databricks.com/t5/data-engineering/dlt-pipeline-overwrite-except-for-one-append-table/m-p/168984#M56017</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/256888"&gt;@Melia-Taylour&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;In DLT/SDP, a streaming_table does not require your raw source (the CSV) to be a streaming source. When you read a standard Delta table with spark.readStream, Delta Lake interprets the table's transaction log as a stream of commits to the table.&lt;/P&gt;&lt;P&gt;Each time you overwrite your CSV with updated data and Table1 is recomputed/overwritten, the new rows will show up as a new commit in Table1 for Table2 to read from.&lt;BR /&gt;Recommended Implementation&lt;/P&gt;&lt;P&gt;Python&lt;BR /&gt;import dlt&lt;BR /&gt;from pyspark.sql import functions as F&lt;BR /&gt;# 1. Batch Table: Overwrites on every pipeline run&lt;BR /&gt;@dlt.table(&lt;BR /&gt;name="Table1",&lt;BR /&gt;comment="Batch table refreshed with the latest CSV snapshot"&lt;BR /&gt;)&lt;BR /&gt;def table1():&lt;BR /&gt;# Regular batch read from CSV&lt;BR /&gt;return (&lt;BR /&gt;spark.read&lt;BR /&gt;.option("header", "true")&lt;BR /&gt;.csv("/path/to/source.csv")&lt;BR /&gt;.withColumn("ingested_at", F.current_timestamp())&lt;BR /&gt;)&lt;BR /&gt;# 2. Historical Table: Incrementally appends new batch commits&lt;BR /&gt;@dlt.table(&lt;BR /&gt;name="Table2",&lt;BR /&gt;comment="Append-only historical archive of Table1 snapshot runs"&lt;BR /&gt;)&lt;BR /&gt;def table2():&lt;BR /&gt;# spark.readStream turns Table1's transaction log into a stream,&lt;BR /&gt;# appending new incoming batches without overwriting existing history.&lt;BR /&gt;return spark.readStream.table("LIVE.Table1")&lt;/P&gt;&lt;P&gt;How It Works Under the Hood&lt;BR /&gt;Table1 (Batch): This is a regular materialized view. On every pipeline run, it will overwrite itself with the latest CSV snapshot.&lt;BR /&gt;Table2 (Streaming Table): This is a streaming query that uses the streaming reader to read from Table1's transaction log. By using spark.readStream.table("LIVE.Table1"), any new commits to Table1 (i.e. new CSV snapshots) will show up as new records in Table2.&lt;BR /&gt;Important consideration: Overwrites vs Appends in Table1&lt;BR /&gt;If Table1 does a full overwrite on every run (i.e. replaces existing keys with updated values) and Delta logs record those as row deletions, you may need to set the skipChangeCommits option when reading Table1 as a stream:&lt;BR /&gt;Python&lt;BR /&gt;@dlt.table(name="Table2")&lt;BR /&gt;def table2():&lt;BR /&gt;return (&lt;BR /&gt;spark.readStream&lt;BR /&gt;.option("skipChangeCommits", "true")&lt;BR /&gt;.table("LIVE.Table1")&lt;BR /&gt;)&lt;BR /&gt;Alternative: Auto Loader directly for History&lt;BR /&gt;If your CSV source contains sequentially named files (data_2026_09_01.csv, data_2026_09_02.csv, etc.) that get periodically ingested, you can also use Auto Loader (spark.readStream.format("cloudFiles")) to directly load Table2's history from storage. This approach will append every CSV file as a new record in Table2.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2026 12:58:58 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/dlt-pipeline-overwrite-except-for-one-append-table/m-p/168984#M56017</guid>
      <dc:creator>Satyasai</dc:creator>
      <dc:date>2026-09-17T12:58:58Z</dc:date>
    </item>
    <item>
      <title>Re: DLT Pipeline - Overwrite except for one Append table</title>
      <link>https://community.databricks.com/t5/data-engineering/dlt-pipeline-overwrite-except-for-one-append-table/m-p/168996#M56020</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/256888"&gt;@Melia-Taylour&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For &lt;STRONG&gt;Table1&lt;/STRONG&gt;&amp;nbsp;&lt;STRONG&gt;@dp.table &lt;/STRONG&gt;approach is fine if you want it to represent the latest/current state on each pipeline update.&lt;/P&gt;&lt;P&gt;For Table2, use&amp;nbsp;&lt;STRONG&gt;create_auto_cdc_from_snapshot_flow&amp;nbsp;&lt;/STRONG&gt;with &lt;STRONG&gt;scd_type=2&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;dp.create_streaming_table("Table2")
dp.create_auto_cdc_from_snapshot_flow(
    target="Table2",
    source="Table1",
    keys=["id"],
    stored_as_scd_type=2
)&lt;/LI-CODE&gt;&lt;P&gt;&lt;STRONG&gt;Table1&lt;/STRONG&gt; can represent the latest snapshot on each run and create_auto_cdc_from_snapshot_flow() compares that snapshot with the previous one. It &lt;STRONG&gt;updates Table2&lt;/STRONG&gt; only when a key is new, changed or removed. With SCD Type 2, changed rows create new history versions using &lt;STRONG&gt;__START_AT&lt;/STRONG&gt; and &lt;STRONG&gt;__END_AT.&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;If the new snapshot is identical to the previous one, no new history rows are created. So you get change based history without needing a streaming source or custom append logic.&lt;/P&gt;&lt;P&gt;Let me know if that answers your question. If not, post an example on how the history has to be retained.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2026 13:44:18 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/dlt-pipeline-overwrite-except-for-one-append-table/m-p/168996#M56020</guid>
      <dc:creator>data_pulse</dc:creator>
      <dc:date>2026-09-17T13:44:18Z</dc:date>
    </item>
    <item>
      <title>Re: DLT Pipeline - Overwrite except for one Append table</title>
      <link>https://community.databricks.com/t5/data-engineering/dlt-pipeline-overwrite-except-for-one-append-table/m-p/169007#M56022</link>
      <description>&lt;P data-pm-slice="1 1 []"&gt;If history means changed versions by key, define &lt;CODE&gt;Table1&lt;/CODE&gt; as a batch materialized view and feed it to &lt;CODE&gt;AUTO CDC FROM SNAPSHOT&lt;/CODE&gt;; its source can be a table or view, so the CSV doesn't need streaming semantics (&lt;A href="https://docs.databricks.com/aws/en/ldp/developer/python-dev" target="_blank"&gt;Python datasets&lt;/A&gt;, &lt;A href="https://docs.databricks.com/aws/en/ldp/developer/ldp-python-ref-apply-changes-from-snapshot" target="_blank"&gt;snapshot API&lt;/A&gt;).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class="language-python"&gt;from pyspark import pipelines as dp

dp.create_streaming_table("Table2")
dp.create_auto_cdc_from_snapshot_flow(
    target="Table2",
    source="Table1",
    keys=["id"],
    stored_as_scd_type=2,
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Replace &lt;CODE&gt;id&lt;/CODE&gt; with the column or columns that uniquely identify a source row; SCD Type 2 adds a version when values for an existing key change (&lt;A href="https://docs.databricks.com/aws/en/ldp/developer/ldp-python-ref-apply-changes-from-snapshot" target="_blank"&gt;snapshot API&lt;/A&gt;, &lt;A href="https://docs.databricks.com/aws/en/ldp/cdc" target="_blank"&gt;CDC examples&lt;/A&gt;). This API requires serverless Lakeflow pipelines or the &lt;CODE&gt;Pro&lt;/CODE&gt; or &lt;CODE&gt;Advanced&lt;/CODE&gt; edition (&lt;A href="https://docs.databricks.com/aws/en/ldp/cdc#requirements" target="_blank"&gt;CDC requirements&lt;/A&gt;).&lt;/P&gt;
&lt;P&gt;The table/view form reads one snapshot per update; if snapshots can accumulate between updates, use the documented version-function source to process them in order (&lt;A href="https://docs.databricks.com/aws/en/ldp/cdc#auto-cdc-from-snapshot-examples" target="_blank"&gt;snapshot examples&lt;/A&gt;).&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;append_flow&lt;/CODE&gt; requires streaming input unless &lt;CODE&gt;once=True&lt;/CODE&gt;, which runs batch input once; &lt;CODE&gt;skipChangeCommits&lt;/CODE&gt; ignores modifying commits, so it won't archive &lt;CODE&gt;Table1&lt;/CODE&gt; overwrites (&lt;A href="https://docs.databricks.com/aws/en/ldp/developer/ldp-python-ref-append-flow" target="_blank"&gt;append flow&lt;/A&gt;, &lt;A href="https://docs.databricks.com/aws/en/structured-streaming/delta-lake#skip-upstream-change-commits-with-skipchangecommits" target="_blank"&gt;Delta streaming&lt;/A&gt;).&lt;/P&gt;
&lt;P&gt;Use regular updates because a full refresh clears streaming-table data and flow checkpoints before rebuilding from available source data (&lt;A href="https://docs.databricks.com/aws/en/ldp/updates#pipeline-refresh-semantics" target="_blank"&gt;update semantics&lt;/A&gt;).&lt;/P&gt;
&lt;P&gt;If history means every delivery row, land each CSV as a new file and ingest &lt;CODE&gt;Table2&lt;/CODE&gt; directly with Auto Loader (&lt;A href="https://docs.databricks.com/aws/en/ingestion/cloud-object-storage/auto-loader/" target="_blank"&gt;Auto Loader&lt;/A&gt;).&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2026 16:07:27 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/dlt-pipeline-overwrite-except-for-one-append-table/m-p/169007#M56022</guid>
      <dc:creator>AbhilashNagilla</dc:creator>
      <dc:date>2026-09-17T16:07:27Z</dc:date>
    </item>
  </channel>
</rss>

