<?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 Re: Merging 2 versions of an SCD table created from a managed ingestion pipeline in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/merging-2-versions-of-an-scd-table-created-from-a-managed/m-p/164440#M55269</link>
    <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/196905"&gt;@swang-pg&lt;/a&gt;&amp;nbsp;We did not run into the error but had a similar situation of stitching tables while using Salesforce and Mysql connectors so I can share what we did.&amp;nbsp;Two things about the situation shape what the merge can look like.&lt;/P&gt;&lt;P&gt;The first is that the merge cannot go into the ingestion table. The destination of a managed ingestion pipeline is a streaming table that only its own pipeline is allowed to write; a MERGE INTO is rejected, and you cannot attach your own flow to the connector's pipeline. So the combined history has to live in an object you own, fed by the connector's table.&lt;/P&gt;&lt;P&gt;The second is that everything in the backup is finished history; those closed SCD2 versions will not change again. So this is a one-time stitch plus the live feed you already have, not an ongoing two-way merge.&lt;BR /&gt;&lt;BR /&gt;So this gives us couple of options:&lt;/P&gt;&lt;P&gt;(1) If your consumers can query a different name, a view is the simplest/low lift answer. Close the backup's open versions at the point where the refreshed table takes over, then union the two:&lt;/P&gt;&lt;P&gt;```sql&lt;BR /&gt;CREATE OR REPLACE VIEW account_history_full AS&lt;BR /&gt;WITH cutover AS (&lt;BR /&gt;SELECT Id, MIN(__START_AT) AS new_start&lt;BR /&gt;FROM live_catalog.sfdc.account&lt;BR /&gt;GROUP BY Id&lt;BR /&gt;)&lt;BR /&gt;SELECT b.* EXCEPT (__END_AT),&lt;BR /&gt;COALESCE(b.__END_AT, c.new_start) AS __END_AT&lt;BR /&gt;FROM backup_catalog.sfdc.account_backup b&lt;BR /&gt;LEFT JOIN cutover c USING (Id)&lt;BR /&gt;UNION ALL&lt;BR /&gt;SELECT a.* EXCEPT (__END_AT), a.__END_AT&lt;BR /&gt;FROM live_catalog.sfdc.account a;&lt;BR /&gt;```&lt;/P&gt;&lt;P&gt;There is no compute to schedule and nothing to keep in sync, and the connector table stays the single live object. If the refresh added or reactivated columns the backup lacks, write the column lists out explicitly.&lt;/P&gt;&lt;P&gt;(2) If you do need one physical table that stays current, I found a good &lt;A href="https://docs.databricks.com/aws/en/ldp/database-replication" target="_blank"&gt;&lt;STRONG&gt;article&lt;/STRONG&gt;&lt;/A&gt; that I implemented eventually. The idea is to create a small declarative pipeline of your own with two AUTO CDC flows writing the same SCD2 target. One is a one-time backfill flow (`create_auto_cdc_flow` with `once=True`) reading the backup as a batch, sequenced by the old `__START_AT`, which rebuilds the pre-incident version chain. The other is a continuous flow reading the connector table's change feed from the refresh onward. Both are AUTO CDC, which is what lets them coexist on one target. We run this shape in production, and both flows register in a single deploy with no handoff. The cost is that you own delete handling, schema drift, and full refresh behavior on the copy from then on, so I would only take this path if the view cannot serve your consumers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 30 Jul 2026 03:16:27 GMT</pubDate>
    <dc:creator>binlogreader</dc:creator>
    <dc:date>2026-07-30T03:16:27Z</dc:date>
    <item>
      <title>Merging 2 versions of an SCD table created from a managed ingestion pipeline</title>
      <link>https://community.databricks.com/t5/data-engineering/merging-2-versions-of-an-scd-table-created-from-a-managed/m-p/164432#M55266</link>
      <description>&lt;P&gt;We've been using the Salesforce Databricks connector to ingest data into Databricks with history tracking (SCD2) turned on. The licence to one of the add-on modules was accidentally revoked for our ingestion user and subsequently reinstated. This led to some columns generating the error CANNOT_WRITE_TO_INACTIVE_COLUMNS. I backed up the affected tables before doing a full refresh on the affected tables. What's the best way to merge the back up table and ingestion table?&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2026 01:57:37 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/merging-2-versions-of-an-scd-table-created-from-a-managed/m-p/164432#M55266</guid>
      <dc:creator>swang-pg</dc:creator>
      <dc:date>2026-07-30T01:57:37Z</dc:date>
    </item>
    <item>
      <title>Re: Merging 2 versions of an SCD table created from a managed ingestion pipeline</title>
      <link>https://community.databricks.com/t5/data-engineering/merging-2-versions-of-an-scd-table-created-from-a-managed/m-p/164440#M55269</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/196905"&gt;@swang-pg&lt;/a&gt;&amp;nbsp;We did not run into the error but had a similar situation of stitching tables while using Salesforce and Mysql connectors so I can share what we did.&amp;nbsp;Two things about the situation shape what the merge can look like.&lt;/P&gt;&lt;P&gt;The first is that the merge cannot go into the ingestion table. The destination of a managed ingestion pipeline is a streaming table that only its own pipeline is allowed to write; a MERGE INTO is rejected, and you cannot attach your own flow to the connector's pipeline. So the combined history has to live in an object you own, fed by the connector's table.&lt;/P&gt;&lt;P&gt;The second is that everything in the backup is finished history; those closed SCD2 versions will not change again. So this is a one-time stitch plus the live feed you already have, not an ongoing two-way merge.&lt;BR /&gt;&lt;BR /&gt;So this gives us couple of options:&lt;/P&gt;&lt;P&gt;(1) If your consumers can query a different name, a view is the simplest/low lift answer. Close the backup's open versions at the point where the refreshed table takes over, then union the two:&lt;/P&gt;&lt;P&gt;```sql&lt;BR /&gt;CREATE OR REPLACE VIEW account_history_full AS&lt;BR /&gt;WITH cutover AS (&lt;BR /&gt;SELECT Id, MIN(__START_AT) AS new_start&lt;BR /&gt;FROM live_catalog.sfdc.account&lt;BR /&gt;GROUP BY Id&lt;BR /&gt;)&lt;BR /&gt;SELECT b.* EXCEPT (__END_AT),&lt;BR /&gt;COALESCE(b.__END_AT, c.new_start) AS __END_AT&lt;BR /&gt;FROM backup_catalog.sfdc.account_backup b&lt;BR /&gt;LEFT JOIN cutover c USING (Id)&lt;BR /&gt;UNION ALL&lt;BR /&gt;SELECT a.* EXCEPT (__END_AT), a.__END_AT&lt;BR /&gt;FROM live_catalog.sfdc.account a;&lt;BR /&gt;```&lt;/P&gt;&lt;P&gt;There is no compute to schedule and nothing to keep in sync, and the connector table stays the single live object. If the refresh added or reactivated columns the backup lacks, write the column lists out explicitly.&lt;/P&gt;&lt;P&gt;(2) If you do need one physical table that stays current, I found a good &lt;A href="https://docs.databricks.com/aws/en/ldp/database-replication" target="_blank"&gt;&lt;STRONG&gt;article&lt;/STRONG&gt;&lt;/A&gt; that I implemented eventually. The idea is to create a small declarative pipeline of your own with two AUTO CDC flows writing the same SCD2 target. One is a one-time backfill flow (`create_auto_cdc_flow` with `once=True`) reading the backup as a batch, sequenced by the old `__START_AT`, which rebuilds the pre-incident version chain. The other is a continuous flow reading the connector table's change feed from the refresh onward. Both are AUTO CDC, which is what lets them coexist on one target. We run this shape in production, and both flows register in a single deploy with no handoff. The cost is that you own delete handling, schema drift, and full refresh behavior on the copy from then on, so I would only take this path if the view cannot serve your consumers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2026 03:16:27 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/merging-2-versions-of-an-scd-table-created-from-a-managed/m-p/164440#M55269</guid>
      <dc:creator>binlogreader</dc:creator>
      <dc:date>2026-07-30T03:16:27Z</dc:date>
    </item>
  </channel>
</rss>

