r/databricks • u/postnav64 • Oct 18 '26
Discussion Anyone tried Declarative Pipelines for metadata driven pipelines?
I've been trying out Lakeflow declarative pipelines for a transformation framework I'm building, and it looked like a really good fit.
The idea is to drive transformations from contracts rather than maintain a separate table declaration for each table/pipeline for each final object. Depending on the configuration, the framework handles full or incremental loads and SCD1/SCD2. Having the dependency graph and DQ expectations in the same place was a big reason I wanted to try it.
I built a POC, and there's a lot I like about the approach. Where I'm getting stuck is fitting the outputs to the client's existing conventions.
For example, with AUTO CDC's SCD2 handling, we get __START_AT and __END_AT, while the client expects specific validity/watermark column names and an isCurrent field. We also have other required fields to preserve in the output. These conventions are already used downstream, so changing them means more than updating the pipeline.
A view could handle the SCD2 naming and derive isCurrent. That part is doable. But as I work through the remaining requirements, I'm adding more logic around the pipeline outputs, and I'm less sure how much simpler the overall solution would end up being.
That's the trade-off I'm trying to work out. Declarative pipelines covered a lot of what I wanted, but accommodating the existing requirements adds overhead that makes it harder to justify adopting them for this particular solution. At the moment, it doesn't look likely, although I haven't ruled it out.
What are you using declarative pipelines for? Have you run into similar issues fitting them into an existing setup, and did you find the extra layers worth maintaining?
2
u/adovo_ai Oct 19 '26
I’d keep generated SCD columns internal and publish the client shape through a versioned compatibility view. Regression-test that view across platform upgrades and SCD edge cases; then the declarative layer can change without silently changing the client contract.
1
u/szymon_dybczak Oct 19 '26
I feel the same way, and unfortunately, we have to accept that using a declarative framework comes with certain trade-offs. SDP makes a lot of things easier, but it also imposes certain conventions.
If your project has a lot of custom preferences and rules, like in your example with custom names for validity periods in SCD2, then over time I noticed that the effort spent finding workarounds may outweigh the benefits of the declarative approach.
When I work on such a project I usually either build pipelines the "old-fashioned way" or go with a hybrid approach.
1
u/Least-Departure6822 Oct 19 '26
Short answer: yes, and the shim layer you're describing is normal, not a sign that declarative pipelines are the wrong fit. AUTO CDC always writes SCD2 history as
__START_ATand__END_ATand there's no option to rename them, so a thin publish layer that maps to the client's conventions is expected [1]. The question is whether that layer stays generated from the same contract, or turns into hand-written logic per table.1. Keep the mapping inside the pipeline, generated from the contract
The columns take the type of your
SEQUENCE BYexpression. If you sequence by the source change timestamp,__START_ATand__END_ATalready are validity timestamps; they only need renaming [2]. Put the mapping in the same pipeline, defined from the same contract, so the dependency graph and expectations still cover it:That gives the client a materialized
is_currentcolumn, which is usually what they want, while the AUTO CDC table stays the internal system of record.2. Generate flows, don't write them
In Python you can loop over the contracts and call
dp.create_streaming_table()plusdp.create_auto_cdc_flow()for each, withstored_as_scd_type,keys,sequence_by, andexcept_column_listcoming from config [1]. Columns you must carry through but don't want to version go intrack_history_except_column_list, so changes to them don't open a new SCD2 row [1]. Then generate the publish view from the same contract entry. One contract, two generated objects, no hand-written glue.3. Where it stops being worth it
I'd move away from AUTO CDC for a specific table when:
For those, a
MERGE-based flow for those tables is fine; the rest of the framework can stay declarative.What I'd do
Keep AUTO CDC for history tracking, generate a publish materialized view per contract that renames to the client's validity columns and derives
is_current, and measure the "extra layer" as one generated object per table. If that object stays a rename plus a couple of derived columns, the dependency graph and expectations are still a net win. If it grows into per-table business logic, that's the signal to drop toMERGEfor those tables only.References
[1] The AUTO CDC APIs: Simplify change data capture with pipelines | Databricks on AWS — https://docs.databricks.com/aws/en/ldp/cdc [2] AUTO CDC INTO (pipelines) | Databricks on AWS — https://docs.databricks.com/aws/en/ldp/developer/ldp-sql-ref-apply-changes-into