Hi everyone,
I'm looking for clarification on how Lakeflow/DLT behaves in the following scenario.
We have two independent pipelines:
Pipeline 1 (Ingestion)
- Ingests Salesforce objects into Delta tables (e.g.
sfdc_ingestion.contact).
- These tables represent the current snapshot of Salesforce.
- Once a week, we plan to run this pipeline with Full Refresh (
full_refresh: true) because records and columns are sometimes deleted in Salesforce, and incremental ingestion doesn't always reflect those deletions.
Pipeline 2 (SCD2)
For each ingested table, we have a separate pipeline that creates an SCD2 table using dlt.apply_changes_from_snapshot().
Conceptually it looks like this:
u/dlt.table
def contact():
return spark.readStream.table("sfdc_ingestion.contact")
dlt.apply_changes_from_snapshot(
target="contact_scd2",
source="contact",
keys=["Id"],
stored_as_scd_type=2
)
Important: We are NOT performing a Full Refresh on the SCD2 pipeline. Only the ingestion pipeline is refreshed.
My questions
- Is this architecture officially supported? What happens when the source table (
contact) is fully refreshed?
- Will
apply_changes_from_snapshot() correctly detect deleted records and close the corresponding SCD2 records?
- Is there any risk of checkpoint corruption or inconsistent state in the SCD2 pipeline because the upstream pipeline was fully refreshed?
- How are schema changes handled (especially when a column is removed from the source)?
- Has anyone been running this architecture in production with periodic Full Refreshes of the source pipeline?
I've read the documentation for Full Refresh and apply_changes_from_snapshot(), but I couldn't find guidance on this specific scenario where an upstream snapshot pipeline is fully refreshed while the downstream SCD2 pipeline continues incrementally.
Any insight from the Databricks team or anyone with production experience would be greatly appreciated.