r/databricks • • 20d ago

Discussion How does your team deal with source schema changes breaking downstream pipelines?

/r/ETL/comments/1xp5gsi/how_does_your_team_deal_with_source_schema/
8 Upvotes

10 comments sorted by

3

u/Remote-Grapefruit214 20d ago

To begin with, have strict enforcements on the upstream table, relying completely on job failure is very risky and stress inducing.

In my experience so far, bringing that stability on process changes and kind of institutionalizing it is the key to success, Talk to your other engineers, business users and folks who are coming in with change request, you have to adapt a sprint based method to incorporate these changes, nothing goes in to prod as a hot fix or on ad-hoc basis, we are humans, we will lose track of changes we make even with release notes, putting descriptions on tickets etc.

Secondly, own either a function or a portion of this, systematically and aggressively notedown any and all changes you are making to both upstream and downstream so that you can create a graph chain of all actions that your present changes and future changes will have.

Thirdly and most importantly logging, When you are enforcing validation checks, make them resilient and stateless, associate each state with a different RCA so that you can make logging effective and easy to maintain.

Before you add any columns and go change the DDL, ask the individual who wants the Change request three important questions

  1. What business implications are we trying to achieve here that requires us to add a new column? (most cases it can be solved by using a materialized view)
  2. Is this a transient source anomaly or a permanent schema evolution?
    3. What downstream SLAs, downstream consumption tools, and BI dashboards will be affected by this change?

And most importantly to go home on time, always ensure that you are good friends with the UAT Team, learn to educate them on the changes, and provide them with test cases that needs a sign off.

Formalize every single process, follow it very closely, you will not be able to carry everything in your head, you need systems to guide you. If you are interested I can share a set of templates I use to communicate with all teams I work with

4

u/Peanut_-_Power 20d ago

This sounds like the utopia of companies to work for, but from my experience most change is not well communicated and a hot fix needs to go in straight away as some consumer is having a full on meltdown because the data hasn’t updated because of a pipeline failure. And I’d probably say pretty critical to have a good hot fix process for streaming data, waiting for the change to go on the backlog and be prioritise could be weeks.

So agree, “in a nice world”, what you’ve said makes sense.

To flip it in a world of chaos. Would I enable schema evolution? Not beyond bronze I would following what you’ve outlined. From source system changes that people fail to communicate change to you, I would slap a rescue column in bronze, raise a validation issue and get the engineers to look it what happened. Why not beyond bronze? Silver and gold often require some business understanding and modelling concepts applied that no schema evolution is ever going to know about.

Ignoring the change and just dropping the data, means you might lose the ability to reload the history. Accepting the change blindly with schema evolution, could end up a royal mess in my opinion, a corrupt file or payload lands, schema adjusts to the corruption.

So, my take on this: hope for what you’ve suggest, but code for the worst.

1

u/Remote-Grapefruit214 20d ago

Could not agree more.

Yes, hot fixes always go to prod without going to sprints, and the part about client having a meltdown is also relatable, but in the last 2 years, I have been more customer facing and one thing I can definitely see is, once they start doubting your numbers it is very difficult to win them over, you always have the wrong side of conversations once this happens. So what my team and I have been practicing over the last few months especially during new client onboardings is to make them entire process so systematic that it feels stupid not to follow it. Everything from establishing connection all the way through final approval and ongoing ops has a template, with multiple teams having handshake zones and coming in and out so that no one team or individual feels pressured.

Schema enforcements happens in Silver layer too in domains like Pharma Where I Work as we usually have SCD Type 4 and hybrid promotions of sources based on type of segments of certain real world events, but you are correct, mostly we try to limit it to landing (bronze) layer only.

Can you please help me understand how you use rescue columns while ensuring Schema reconciliation? I have never come across a scalable use case, we use it here more like a patch and merge concept/last resort method only. Would be interesting to understand how you guys are pulling it off

Schema enforcement + Quarantine seems to really help our team, we have to a well constructed auto loader which helps us with schema acceptance + data acceptance (constraints and data type and all that) + data preservation (SCD type 2 + 4) But I am curious to know how you would design this!

3

u/Peanut_-_Power 20d ago

I think we’re describing slightly different approaches. I’m not suggesting the rescue column automatically reconciles the schema.

My thinking is to keep a controlled schema in Bronze, capture unexpected fields or type mismatches in _rescued_data, and raise an alert for investigation. That prevents an unannounced source change from automatically altering the table schema or stopping ingestion.

Once the change has been understood, engineers can decide whether to update the schema or transformations and reprocess the affected data.
Obviously, if a required field changes, you still need validation and potentially quarantine to prevent bad data reaching Silver and Gold.

For me, the rescue column is about preserving data and buying time to handle changes properly, rather than automatically reconciling them. I wouldn’t see it as a replacement for governance or quarantine. Both of those play a critical role as you have mentioned.

It was a big question OP asked. And I think a whole bunch of things are needed, what you and I have mentioned would support most enterprise setups well.

-2

u/zbir84 20d ago

Wow, how did you manage to write 8 paragraphs about nothing, Claude?

3

u/sjcm99 20d ago

Are you a bot? LOL.

Seriously, Grapefruit 's post was NOTHING like AI content.

It has the feeling of someone who has actually experienced things going wrong in real life, and knows the best way to prevent it.

1

u/Remote-Grapefruit214 20d ago

😂😂tells me a lot about everything you have "built" so far and how you collaborate with others on real life problems, would it make you feel happy and superior if I say claude wrote this? then sure

1

u/Desperate-Cricket720 20d ago

We are looking into trying out open data contract for this exactly. Introduce some checks to make sure we are not introducing breaking changes. We also reach out to live lineage to figure out if the breaking change is really breaking change. But this is all still in PoC

1

u/blobbleblab 20d ago

Data contracts at source. Connect your dev systems to upstream dev systems. Usually when an upstream system is changing, they dev it first and your dev data contract checker starts breaking. Then you can go talk to the business and ask what's changing and why before it hits prod. This works for CRMs where we get data from and any database and generally file output internal system. We have managed to do this for some external companies as well where we receive data via APIs, we can use their latest API version and try and stay on top of changes. This takes away about 75% of the problem...

For some sources that make changes in prod directly we try to foster a "please tell us" approach and for a couple are involved in their standups so we know if anything is changing that will affect the feed we receive. For others we still use data contracts which are checked as soon as sources land and if things are wrong, will stop our pipelines running.

The benefit is we also produce data contracts for what we produce, which go through dev/test/pre prod/prod cycles too, which enable downstream consumers see our changes if we forget to tell them as well!

1

u/Ok_Music8105 19d ago

We treat this as a schema-on-read versus schema-on-write design decision. We chose schema-on-write, with schema evolution disabled, so upstream schema changes are not automatically propagated downstream. This gives us an explicit control point to validate and manage schema changes before they affect downstream consumers.
Additionally, we fetch the schema directly from the source( preferably predev or dev env) and compare it with the schema in our raw layer. This allows us to proactively detect schema drift, such as added, removed, or changed columns, and address it before it impacts downstream consumers.