A data file landing in your storage is a delivery, and deliveries should be looked at. Data arrival checks are the small set of questions a pipeline asks the moment new data shows up, before any table, report or model is allowed to use it. This explainer covers what those checks are, where to place them and what to do when they fail, without assuming you have a large platform or a big budget.
The idea is ordinary. A warehouse worker counts boxes against the order slip before stocking shelves. A data engineer should count rows against expectations before loading downstream tables. The difference is that bad data does not look dented, so you have to ask it directly.
What data arrival checks actually do
They compare what came in with what was agreed. Not whether the numbers are interesting, not whether the business is doing well, only whether this delivery resembles the thing the consumer is expecting. If it does, it moves on. If it does not, it waits in a holding area where nothing depends on it yet.
That separation is the whole point. Once a broken batch is merged into a shared table, removing it means finding every job that read it. Stopping it at the door means fixing one file.
The six questions to ask first
Did it arrive at all, and on time?
Silence is a failure mode. A scheduled export that never appears will not raise an error in a job that simply processes whatever is present. Record the expected window for each source and alert when the window closes empty.
Is it the right size?
Compare file size and row count with a reasonable range drawn from recent deliveries. A file that is a tenth of its usual size may be a truncated transfer. One that is double may contain a repeated load.
Can it be opened?
Parse the whole thing, not just the first lines. Broken quoting, mixed encodings and an incomplete final record usually hide near the end.
Does the shape match?
Check column names, order where order matters, and types. A new column may be harmless. A missing one or a number that became text deserves a stop.
Are the key fields sane?
Identifiers should not be empty or duplicated where uniqueness is promised. Dates should fall inside the period the file claims to cover. Currency or unit fields should contain only the codes you expect.
Is it really new?
Compare a hash or the latest timestamp with the previous delivery. Upstream systems sometimes resend yesterday’s output with today’s file name.
Where to put the checks
Use a three-zone layout. Incoming files land in a raw area that no consumer can query. A validation step reads them and writes a short result record. Only passing batches are promoted to the clean area that dashboards and models read. This can be three folders and one script; it does not need a special product to be useful.
Frameworks help once the list grows. If you want to express expectations as readable rules, the site has a practitioner’s tour of Great Expectations as a validation layer. Transformation layers can hold tests too, and there is a related piece on managing transformations with dbt inside modern pipelines.
Write the expectation with the sender
Checks are only as good as the description behind them. Sit down with whoever produces the data and agree on a short contract: delivery window, format, required columns, allowed values and who to message when something changes. Keep it in the same repository as the pipeline so updates get reviewed.
Do not guess thresholds from a single week. Look at enough history to include a quiet day, a busy day and a month end. Then leave some room. Rules that fire constantly get muted, and a muted check protects nothing.
Decide what failure means before it happens
Not every mismatch should stop everything. Sort rules into two groups.
- Blocking: missing required columns, unreadable files, empty deliveries, duplicated primary keys. The batch is held and the owner is notified.
- Warning: an unusual but possible row count, a new optional column, a slightly higher share of blanks. The batch moves on and a note is logged for review.
When a batch is held, keep it unchanged. Editing the raw file destroys the evidence the producer needs. Copy it, annotate the copy and send a message that contains the file name, the rule that failed, the observed value and the expected value.
Tell the consumers
A held delivery means a report will be stale. Say so where people read it. A small banner that says the latest load is being checked is far better than a confident chart built on half the data. Include when you expect to update it, even if the answer is that you are waiting on the sender.
A side example from outside the warehouse
The habit carries over to anything handed to a data team, such as a front end for an internal catalogue. If a colleague picks a layout after browsing the web template listings gathered on ThemeRove, or from anywhere else, the sensible move is to extract it somewhere disposable, then match its file list and release number against the request ahead of any live connection.
Mistakes that undo the value
- Running validation after the data has already been published.
- Checking only the schema and ignoring whether the contents are stale.
- Sending failures to a channel nobody owns.
- Letting engineers override a block with no record of the reason.
- Writing dozens of rules before the first five are trusted.
Careers: why this skill is worth practising
Interviewers for data roles often ask what you would do when a source misbehaves. A candidate who can describe the raw zone, the contract and the blocking rules is showing practical judgement. Build a tiny version as a portfolio project: generate files with deliberate faults, write checks that catch them, and document the response for each.
A tiny worked example
Say a partner sends a daily orders file. The agreement says it arrives each morning, is comma separated, contains an order identifier, a customer code, an amount, a currency and a timestamp, and normally holds a few thousand rows. One morning a file appears on schedule. It opens, but the amount column now reads as text because some values carry a currency symbol, and the row count is far below the usual range.
The first rule blocks on the type change. The second raises a warning about volume. The validation step moves nothing forward and writes a record naming both observations with two sample rows. The engineer forwards that record to the partner, who explains that an export setting was altered during maintenance and resends. The dashboards show yesterday’s figures with a visible note until the corrected file passes. Nobody has to untangle wrong totals.
Keeping a record of what arrived
For every delivery, store a small row: source, file name, hash, size, row count, arrival time, rule results and final disposition. This log costs almost nothing and answers the questions that come up later, such as when a column first changed or how often a particular sender misses the window. It also helps you tune thresholds with evidence rather than memory.
Streams and APIs
Not every delivery is a file. For streams, apply the same thinking over short windows: message count, schema version, share of rejected events and lag between event time and arrival. For API pulls, confirm status, page completeness and that pagination reached the end before saving the result as complete. Send messages that fail into a dead-letter queue that someone actually reads.
Handling late and replacement files
A corrected resend deserves the same questions as the original. Do not wave it through because it answers your complaint. Run every rule again, compare it with the held version to confirm that only the expected parts changed and record which file replaced which. If downstream tables already used an earlier partial load, name them and rebuild them in order. Give the replacement a distinct identifier so that two files with the same name can never be confused when someone investigates months later.
Start small today
Choose your most depended-upon source. Add three blocking rules: it arrived, it opens fully, and required columns exist. Run them before promotion. After a few weeks, look at what slipped past and add one rule for it. The pipeline gets sturdier one delivery at a time, and you spend less time explaining strange numbers after the fact.