Data Engineer Interview Questions
40+ original questions across SQL, data modeling, Spark, Airflow, dbt, batch vs streaming, data quality, cloud data warehouses, and the AI-era skills every data engineering interview now touches.
15 Fresher17 Mid-Level11 Senior
Fresher
What's the difference between a primary key and a foreign key, and what does a foreign key constraint protect against?
A primary key uniquely identifies each row in its own table — no two rows can share one, and it can't be null. A foreign key is a column (or set of columns) in one table that references a primary key in another table, establishing a relationship between the two — an
orders table's customer_id column referencing customers.id, for instance. The constraint part matters because, without it, nothing stops an orders row from being inserted with a customer_id that doesn't exist in the customers table at all — an orphaned reference pointing at nothing, which silently breaks any join expecting that relationship to be real. A foreign key constraint enforces at the database level that any value placed in that column must already exist in the referenced table, rejecting the insert outright if it doesn't, which is a much stronger guarantee than relying on application code to always remember to check first.What interviewers look for
- correctly explains uniqueness for primary keys and the referencing relationship for foreign keys
- explains the orphaned-reference problem a constraint prevents
- notes this is a database-level guarantee, not reliant on application code
What does COALESCE do, and where would you use it in a data pipeline that merges data from two source systems?
COALESCE returns the first non-null value from a list of expressions, checked left to right — COALESCE(a, b, c) returns a if it isn't null, otherwise b if that isn't null, otherwise c. In a pipeline merging two source systems that both sometimes populate the same logical field (say, a customer's email, where one system might have it filled in and another might not), COALESCE(system_a.email, system_b.email) picks whichever source has a value, falling back to the second only when the first is missing. This is a common building block in deduplication and merge logic generally, where records from multiple sources need to be combined into one 'best available' row — it avoids writing a verbose CASE WHEN column IS NOT NULL THEN column ELSE other_column END for every field that needs this fallback behavior.What interviewers look for
- correctly explains COALESCE returns the first non-null value in order
- gives a concrete pipeline use case (merging from multiple sources)
- contrasts it with the more verbose CASE WHEN equivalent
What does UNION do differently from UNION ALL, and why can that difference matter for a pipeline processing a large number of rows?
UNION combines the result sets of two queries and removes duplicate rows from the combined result, while UNION ALL combines them and keeps every row, duplicates included. Removing duplicates isn't free — the database has to compare every row against every other row (commonly by sorting or hashing the full combined result) to find and drop matches, which adds real processing cost that scales with the size of the combined data. In a pipeline moving a large number of rows, defaulting to UNION out of habit when the two source queries are already known not to produce overlapping rows wastes that deduplication cost for no benefit at all, since there's nothing to deduplicate. UNION ALL is the right default whenever duplicates aren't expected or don't matter for the use case, reserving UNION for cases where duplicate removal is a real, needed part of the result.What interviewers look for
- correctly explains UNION deduplicates, UNION ALL doesn't
- explains deduplication has a real processing cost at scale
- recommends UNION ALL as the default unless deduplication is needed
What's the difference between a DAG's schedule_interval and the execution_date (or logical date) of a specific DAG run, and why does the execution date often not match the time the run really started?
schedule_interval defines how often a DAG is meant to run — daily, hourly, a cron expression — while the execution date (called the logical date in newer Airflow versions) represents the start of the data interval that specific run is responsible for processing, not the real-world clock time the run happened to kick off. A daily DAG scheduled to run 'for' January 1st is typically triggered only after January 1st has fully ended, once all of that day's data is expected to be available — so the run with an execution date of January 1st starts executing on January 2nd, which surprises newcomers expecting the execution date to mean 'when this ran.' This design exists so a DAG consistently knows which data interval it's responsible for, regardless of whether it ran on time, late, or was manually backfilled — the execution date is a label for the data being processed, not a timestamp of when processing happened.What interviewers look for
- correctly distinguishes schedule_interval (frequency) from execution/logical date (data interval label)
- correctly explains why the execution date typically precedes the real run time
- explains why this design is deliberate, not a quirk
What's the difference between a dbt source and a dbt model, and why does declaring raw tables as sources matter beyond just naming convention?
A dbt
source declares a raw table that already exists in the warehouse, loaded there by something outside dbt entirely (an ingestion tool, a direct load job) — dbt doesn't create or manage sources, it only references them. A model is SQL dbt itself owns, compiles, and builds into a new table or view as part of a dbt run. Declaring raw tables as sources rather than just referencing their table names directly gives dbt two real capabilities it wouldn't otherwise have: it can test freshness, checking whether a source has been updated as recently as expected and failing loudly if an upstream load has silently stopped running, and it extends dbt's dependency graph to include where data originates, so a lineage graph shows the true starting point rather than appearing to start from whichever model happens to query the raw table first.What interviewers look for
- correctly distinguishes externally-loaded sources from dbt-owned models
- names source freshness testing as a concrete capability this enables
- names the lineage/dependency-graph benefit of declaring sources explicitly
What's the difference between a fact table and a dimension table in a star schema, and how do you tell which one a new table belongs in?
A fact table holds the measurable events or transactions a business cares about analyzing — a sale, a page view, a shipment — along with foreign keys pointing to the dimension tables that describe the context of each event, plus numeric measures (amount, quantity) that get aggregated in reports. A dimension table holds the descriptive attributes that give that event meaning — a product's name and category, a customer's region, a date's day-of-week and fiscal quarter — information that changes rarely and is looked up, not summed. The practical test for a new table: if its rows represent discrete events or measurements that will be summed, counted, or averaged in reporting, it's a fact table; if its rows represent relatively stable descriptive context that events reference and reports filter or group by, it's a dimension table. A table with both characteristics mixed together is usually a sign the schema needs to be split into a proper fact/dimension pair rather than left as one flat table.
What interviewers look for
- correctly distinguishes measurable events (fact) from descriptive context (dimension)
- gives a concrete, correct test for classifying a new table
- mentions the flat-table-needs-splitting signal
What does it mean that Spark transformations are 'lazy,' and why does calling .filter() on a DataFrame not process any data by itself?
Spark builds up a logical plan of transformations —
.filter(), .select(), .groupBy() — without executing any of them immediately; each transformation just adds a step to a plan describing what should eventually happen, rather than triggering real computation on the spot. Only an 'action' — .count(), .collect(), writing the result out — triggers Spark to optimize the accumulated plan and execute it across the cluster. This laziness exists so Spark's optimizer (Catalyst) can see the whole chain of transformations before running anything, letting it reorder, combine, or skip steps that turn out to be unnecessary for the final action — a filter applied early in the chain, for instance, can be pushed down so it happens before an expensive join rather than after, reducing how much data the join has to process. A newcomer who expects .filter() alone to 'do something' and sees no visible work happen is observing exactly this laziness, not a bug.What interviewers look for
- correctly explains transformations build a plan without executing
- correctly explains an action is what triggers real execution
- explains why laziness enables optimization (e.g. filter pushdown)
A Spark job's logs show most tasks finishing quickly, but one or two tasks take far longer than the rest and hold up the whole stage. What's this called, and what commonly causes it?
This is data skew — the work isn't distributed evenly across partitions, so a small number of tasks end up processing far more data than the others, and since a stage only completes once every one of its tasks finishes, the slowest straggler task determines the whole stage's completion time regardless of how fast the rest ran. A common cause is a
groupBy or join key with a highly uneven distribution — a small set of key values (a popular product id, a null or default placeholder value used far more often than any real value) that account for a disproportionate share of all the rows, so the partition handling that key ends up vastly larger than every other partition. Fixing it usually means addressing the key distribution directly: salting the skewed key (temporarily splitting it into several sub-keys to spread its rows across more partitions, then combining the results afterward), filtering out or handling a known problematic default value separately before the main join, or in some engines, enabling a built-in skew-handling optimization that detects and splits oversized partitions automatically.What interviewers look for
- correctly names data skew and explains why the slowest task bottlenecks the stage
- identifies an uneven key distribution as the common root cause, with a concrete example
- proposes a real fix (salting, isolating the problematic key, or a built-in skew optimization)
What is a DAG in Airflow, and why does Airflow require the graph of tasks to be acyclic — no loops allowed?
A DAG (Directed Acyclic Graph) in Airflow represents a pipeline as a set of tasks with explicit dependencies between them — task B depends on task A finishing first, task C depends on both A and B, and so on, forming a graph where every edge points in one direction (directed) and there's no path that loops back to a task already completed (acyclic). The acyclic requirement isn't arbitrary: Airflow needs to compute a clear execution order from the dependency graph, and a cycle (task A depends on B, which depends on A) makes that fundamentally impossible to resolve — there's no valid order in which both conditions can be satisfied simultaneously, so Airflow can't schedule a graph with a cycle at all and will reject it outright. This is why pipelines occasionally needing to 'retry an earlier step based on a later one's result' can't model that literally as a loop in the DAG — that kind of conditional retry logic has to be handled through Airflow's retry mechanisms or branching operators instead, working within the acyclic structure rather than against it.
What interviewers look for
- correctly explains a DAG as tasks with directed dependencies
- correctly explains why a cycle makes execution order unresolvable
- mentions how a seemingly cyclic requirement (retry based on later result) is handled
What's the difference between a task's retries setting and Airflow's own scheduler retrying a failed DAG run entirely?
A task's
retries parameter controls automatic re-attempts of that one specific task if it fails — Airflow re-runs just that task, typically after a configured delay, up to the specified number of attempts, without touching any other task in the DAG that already succeeded. This is meant for transient failures — a brief network blip calling an external API, a momentary resource contention — where simply trying again is likely to succeed without any other intervention needed. Re-running an entire DAG run (a manual or triggered re-run of the whole pipeline for a given scheduled interval) is a separate, much heavier operation that re-executes every task in that run, including ones that already succeeded, unless they're configured or manually marked to be skipped. Relying on task-level retries for broken logic (a bug that fails deterministically every time) wastes time and resources repeating a failure that retrying won't fix — that calls for fixing the task and triggering a fresh run, not configuring more retry attempts.What interviewers look for
- correctly distinguishes single-task retry from a full DAG run re-execution
- correctly identifies what task retries are good for (transient failures)
- notes retries don't help a deterministic bug
What does dbt manage, and what does it deliberately not do, compared to a tool like Airflow?
dbt focuses on the 'T' in ELT — transforming data that's already loaded into a warehouse, using version-controlled SQL (or a templating layer on top of SQL) organized into models, with dbt compiling and running those models in the correct dependency order it infers from references between them. It deliberately doesn't handle extracting data from source systems or loading it into the warehouse in the first place — that's left to a separate ingestion tool — and it doesn't function as a general-purpose task scheduler or orchestrator the way Airflow does; dbt runs when it's told to run, typically triggered by something external (a scheduled Airflow task, a cron job, dbt Cloud's own scheduler) rather than managing its own schedule or orchestrating unrelated non-SQL tasks like calling an API or moving files. In most real pipelines, Airflow (or an equivalent orchestrator) is what triggers dbt as one step within a broader DAG that also includes extraction, loading, and whatever downstream tasks consume the transformed data afterward.
What interviewers look for
- correctly scopes dbt to transformation only, not extraction/loading
- correctly explains dbt isn't a general scheduler/orchestrator
- explains how dbt typically fits inside a broader orchestrated pipeline
What's the difference between a dbt model's ref() function and hardcoding a table name directly in the SQL?
ref('model_name') tells dbt to resolve that reference to whatever the, environment-specific table or view name for that model currently is — which lets the same SQL run correctly against a development schema, a staging schema, and production without any change to the code itself, since dbt substitutes the correct fully-qualified name for whichever environment it's currently running against. It also lets dbt build its dependency graph automatically: by tracking every ref() call across all models, dbt knows exactly which models depend on which others and can compute the correct build order without anyone manually specifying it. Hardcoding a table name directly bypasses both benefits — the SQL becomes tied to one specific environment's naming, breaking the moment it's run somewhere else, and dbt has no way to see that dependency at all, which can let models run out of order or miss being rebuilt when an upstream model they silently depend on changes.What interviewers look for
- correctly explains environment-independent resolution via ref()
- correctly explains automatic dependency-graph construction from ref() calls
- explains the two concrete failure modes of hardcoding instead
What's the fundamental difference between batch and streaming processing, and why isn't 'streaming is just batch run more often' an accurate way to think about it?
Batch processing works on a complete, bounded dataset known in advance — a full day's worth of data, a full export file — and runs to completion once that bounded input has been fully processed. Streaming processes an unbounded sequence of data that keeps arriving indefinitely, with no defined 'end' the processing waits for; it has to produce useful, incremental results continuously as new data shows up, rather than waiting for a known-complete input. Running a batch job more frequently (every five minutes instead of once a day) narrows the latency gap but doesn't become streaming, because it still assumes a complete, bounded chunk of new data exists at each run and doesn't have to reason about data arriving mid-computation, out of order, or late relative to when it was generated — concerns streaming systems have to handle natively that a frequent-batch approach can mostly sidestep by just defining a new bounded chunk each time it runs.
What interviewers look for
- correctly explains bounded (batch) versus unbounded (streaming) input
- correctly rejects 'frequent batch = streaming' and explains why
- mentions out-of-order/late data as a streaming-specific concern
What's the difference between a schema validation check and a data quality check, and why does a pipeline need both?
A schema validation check confirms the structure of incoming data matches what's expected — the right columns exist, in roughly the right types, nothing critical is missing from the shape of the data itself. A data quality check goes further, verifying something about the values within a correctly-shaped dataset — that a column meant to hold unique ids truly has no duplicates, that a percentage column's values really fall between 0 and 100, that a foreign-key-style column's values correspond to rows that exist elsewhere. A pipeline needs both because data can pass schema validation perfectly — every expected column present, every type correct — while still being wrong in a way schema checks can't catch at all, like a currency column silently switching units partway through a file, or a date column containing impossible future dates that are structurally valid dates but logically wrong. Relying on schema validation alone gives false confidence that data is 'good' when it's only confirmed to be correctly shaped, not correctly valued.
What interviewers look for
- correctly distinguishes structural (schema) checks from value-level (quality) checks
- gives a concrete example of data passing schema validation while still being wrong
- explains why relying on schema checks alone is false confidence
An AI assistant generates a dbt model's SQL for you from a plain-English description of the transformation needed. What should you check before merging it?
A generated model compiling and running successfully only confirms it's syntactically valid SQL — it says nothing about whether the join logic, aggregation grain, or filter conditions match what was intended, and a model producing a plausible-looking table of numbers with a subtly wrong join (an unintended fan-out duplicating rows, for instance) can pass a casual glance while being meaningfully wrong underneath. Reading through the generated SQL's logic line by line — confirming the join keys and conditions match the intended relationship, checking that the aggregation grain is what was asked for — matters more here than for ordinary application code, because a transformation model's output often feeds directly into reports and decisions without much further scrutiny downstream. Adding or checking the model's dbt tests (uniqueness, not-null, row-count sanity checks against the source) before merging, and comparing a sample of the generated model's output against a manually reasoned expectation for a few known rows, catches the category of subtle logic error that looking correct at a glance wouldn't reveal.
What interviewers look for
- explains compiling successfully doesn't confirm correct logic
- proposes reading the join/aggregation logic carefully, not just running it
- proposes concrete verification (dbt tests, spot-checking known rows)
Mid-Level
A nightly job uses DELETE followed by INSERT to refresh a reporting table, and a query running against that table during the refresh window sometimes sees an empty or partial result. How would you fix this?
Running
DELETE and INSERT as two separate statements creates a real window where the table is empty or partially populated, and any query hitting it during that window sees that incomplete state — this is a genuine race condition between the refresh job and anyone reading the table concurrently, not a rare edge case. Wrapping both statements in a single transaction doesn't fully solve it either under common isolation levels, since a long-running delete-then-insert transaction can still hold the table in an inconsistent state for other readers depending on the database's locking behavior. The more robust pattern is building the new data into a separate staging table first, then atomically swapping it in — either via a single RENAME/table-swap operation that most databases support as a fast metadata-only change, or via a view that's repointed to the new table in one atomic step — so readers always see either the complete old table or the complete new one, never a state in between.What interviewers look for
- correctly identifies the delete-then-insert race condition
- recognizes a single transaction doesn't fully solve it depending on isolation level
- proposes a staging-table-and-swap or equivalent atomic-switch pattern
What's the difference between a Common Table Expression (CTE) and a temporary table, and when does a pipeline need the latter instead of the former?
A CTE is a named, temporary result set defined with
WITH and scoped to a single query — it exists only for the duration of that one statement and is typically inlined or materialized by the query planner as part of executing it, with no persistence beyond that query. A temporary table is a real, separately-created table that persists for the length of a session (or transaction, depending on how it's declared), can be indexed, and can be referenced by multiple separate queries or statements, not just one. A pipeline needs a temporary table rather than a CTE when an intermediate result needs to be reused across several distinct queries or steps (avoiding recomputing the same expensive aggregation multiple times), when the intermediate result benefits from its own index for a later join, or when the intermediate data is large enough that materializing it explicitly, rather than trusting the optimizer's inlining decision for a CTE, gives more predictable performance.What interviewers look for
- correctly explains CTE scope (single query) versus temp table scope (session/transaction)
- correctly identifies reuse across multiple queries as a real reason to need a temp table
- mentions indexing or performance predictability as an additional reason
A customer's address changes, and the reporting team wants historical sales reports to keep showing the address that was correct at the time of each sale, not the customer's current address. How would you model this?
This is the classic Slowly Changing Dimension problem, calling for what's commonly labeled Type 2 handling: rather than updating the existing customer dimension row in place when the address changes, a new row is inserted for that customer with the new address, the old row is marked as no longer current (often with an end-date and a flag), and a surrogate key — not the customer's natural business id — is what fact table rows reference. Every historical sale's fact row keeps pointing at the specific dimension row (the specific surrogate key) representing the customer as they were at the time of that sale, so historical reports naturally keep showing the address that was correct then, since they're joining to that specific historical version, not to 'whatever that customer's row currently says.' This is different from Type 1 handling, which simply overwrites the old value in place and loses the history entirely — appropriate for corrections where the old value was simply wrong, but wrong for genuine changes over time like a real address move that past reports should still reflect accurately.
What interviewers look for
- correctly identifies this as a Slowly Changing Dimension (Type 2) problem
- explains the surrogate key mechanism that preserves historical accuracy
- correctly contrasts this with Type 1 (overwrite) and when each is appropriate
Likely follow-up: How would you handle a dimension attribute that should overwrite in place while another attribute on the same table needs full history?
What's the trade-off between a highly normalized schema and a denormalized one for an analytics warehouse, as opposed to a transactional application database?
A highly normalized schema minimizes data duplication by splitting information into many small, related tables, which is exactly right for a transactional application database — it keeps writes consistent and avoids update anomalies, since a value that changes only needs to change in one place. An analytics warehouse has a different dominant workload: heavy, complex reads across large volumes of historical data, where every additional join needed to reconstruct a denormalized view at query time adds real computational cost, repeated on every single query that needs that view. Denormalizing deliberately in a warehouse — accepting some controlled duplication by pre-joining commonly-needed dimension attributes directly into a wider fact table, for instance — trades a bit of storage and a more complex (or scheduled) write/transform step for meaningfully faster, simpler reads, which is usually the right trade for a system optimized for analytical queries rather than transactional writes. The underlying principle is matching the schema's shape to the dominant workload, not applying one 'correct' normalization level everywhere regardless of how the data is used.
What interviewers look for
- correctly explains normalization's benefit for transactional write consistency
- correctly explains why denormalization helps read-heavy analytical workloads
- frames this as workload-dependent, not one universally correct approach
What's the difference between repartition and coalesce in Spark, and why does using the wrong one for reducing partition count waste cluster resources?
repartition performs a full shuffle, redistributing data across a new number of partitions (which can be more or fewer than the current count) as evenly as possible, at the real cost of moving data across the network between executors. coalesce reduces the partition count without a full shuffle wherever possible, by merging existing partitions together locally — it's much cheaper when just reducing partition count, but it can't increase partition count at all, and it can produce uneven partition sizes since it's combining existing partitions rather than redistributing from scratch. Using repartition to reduce partition count when coalesce would have worked triggers an unnecessary full shuffle — real network and disk I/O cost — for a result coalesce could usually achieve far more cheaply, which matters at scale since shuffles are commonly the single most expensive operation in a Spark job. repartition is still the right choice when the current partitioning is itself badly skewed and needs genuine redistribution, not just fewer partitions, since coalesce alone won't fix an uneven distribution.What interviewers look for
- correctly explains repartition's full shuffle versus coalesce's local merge
- correctly identifies coalesce as cheaper for reducing partition count
- notes the case where repartition's shuffle is still necessary (fixing skew)
A Spark job joins a very large table with a small lookup table, and performance is poor despite the small table being tiny. What optimization would you check for, and why might it not be happening automatically?
A broadcast join is the relevant optimization here: instead of shuffling both large and small tables across the cluster to co-locate matching keys (the default strategy for a join between two large datasets), Spark can send a full copy of the small table to every executor directly, letting each executor join its local partition of the large table against that broadcasted copy with no shuffle of the large table needed at all. Spark usually detects this automatically when the smaller table's estimated size falls under a configurable broadcast threshold, but that estimate can be wrong — a table that looks small logically (few rows) can still be estimated incorrectly if statistics are stale or missing, causing Spark to fall back to a full shuffle join instead of broadcasting. Explicitly hinting the broadcast (a broadcast hint in the query, or manually adjusting the broadcast size threshold) forces the optimization when the automatic size estimate is wrong or unavailable, which is a common, cheap fix for exactly this symptom.
What interviewers look for
- correctly explains the broadcast join mechanism and why it avoids shuffling the large table
- correctly explains why Spark's automatic size estimate can fail to trigger it
- proposes an explicit broadcast hint as the fix
A DAG has a task that queries an external API and a downstream task that processes the response, but the downstream task sometimes starts before the first one has really finished writing its output. What's commonly wrong here?
In Airflow, declaring a dependency between tasks (one task set to run after another) governs execution order, but it doesn't automatically guarantee the downstream task only starts once the upstream task's output is fully written and available in whatever location the downstream task reads from — if the upstream task writes to an external system asynchronously, or the 'finished' signal Airflow sees doesn't perfectly align with 'the data is fully readable elsewhere,' a race condition between the two is possible. The more robust pattern is explicitly passing data between tasks through Airflow's own mechanisms (XComs for small values, or a well-defined, atomically-written file or table location for larger data) rather than relying on an implicit assumption that task ordering alone guarantees data availability — and for a check against an external system, a sensor task that actively polls for the expected output to exist before letting the downstream task proceed closes this gap directly, rather than just hoping task completion timing lines up.
What interviewers look for
- correctly identifies that task ordering doesn't guarantee data readiness downstream
- proposes explicit data-passing (XComs, atomic writes) rather than implicit timing assumptions
- proposes a sensor task as a concrete fix for the external-system case
What does task idempotency mean in the context of a scheduled Airflow pipeline, and why does a pipeline that appends new rows on every run without checking for duplicates violate it?
An idempotent task produces the same end result whether it runs once or is re-run multiple times for the same input — running it again doesn't change the outcome beyond what the first successful run already produced. A task that blindly appends new rows on every run, with no check for whether those rows already exist, violates this directly: if the task is manually re-run after a partial failure, or Airflow retries it, or someone backfills the same date range twice, the same data gets duplicated in the destination table every time it runs again for the same period. This matters because pipeline re-runs are common and expected — a backfill for a past date range, a retry after a transient failure, a manual re-trigger while debugging — and a non-idempotent task turns each of those routine operations into a real risk of corrupting the destination data with duplicates. The fix is usually designing the write step to be a delete-and-replace (or upsert/merge) for the specific partition or date range being processed, rather than a blind append, so re-running the same task for the same period always converges to the same correct end state.
What interviewers look for
- correctly defines idempotency as the same end result regardless of run count
- correctly explains why blind appends violate it with a concrete scenario
- proposes delete-and-replace or upsert/merge as the fix
What's the difference between a dbt view materialization and a table materialization, and what would push you toward incremental instead of either?
A
view materialization creates a database view — the SQL is stored but re-executed fresh against the underlying source every time something queries it, so it's always current with no extra storage, at the cost of recomputing the full query's work on every single read. A table materialization runs the SQL once per dbt run and stores the physical result as a real table, making reads fast afterward since nothing is recomputed per query, at the cost of the table only being as fresh as the last dbt run and needing to fully rebuild from scratch every time. incremental becomes the better choice once a model's full rebuild from scratch starts taking a long time relative to how much the underlying source data changes between runs — rather than reprocessing the entire source every run like table does, incremental processes and appends or merges in only the new or changed rows since the last run, which can turn a rebuild that would otherwise scale with total historical data size into one that scales with just the new data arriving since last time.What interviewers look for
- correctly explains the view (always fresh, slow reads) vs table (fast reads, stale until rebuilt) trade-off
- correctly explains incremental's advantage: processing only new/changed data, not the full source
- correctly identifies when that advantage becomes worth the added complexity
A dbt project has a growing number of models with no tests defined on them at all. What specific risk does this create, and what's a reasonable minimum testing standard to push for?
Untested models can silently start producing wrong results the moment an upstream source's data shape or quality changes — a column that starts containing unexpected nulls, a key that stops being unique after a source system change, a join that starts duplicating rows — and without any dbt test checking for exactly that, the broken output flows downstream into every model and report that depends on it, discovered only whenever someone downstream happens to notice a number looks wrong, which can be a long delay after the break happened. A reasonable minimum standard most teams converge on: every model's primary key column gets a
unique and not_null test at minimum, and any foreign-key-style relationship between models gets a relationships test confirming referential integrity really holds — these three generic tests are cheap to add, catch a large share of real data-quality breaks, and don't require writing custom SQL for each one, which is usually what makes 'no tests at all' a pure cost-saving shortcut rather than a reasonable trade-off, since the minimum tests are low-effort to add.What interviewers look for
- correctly explains how a silent break propagates downstream undetected
- proposes a concrete minimum standard (unique/not_null on keys, relationships tests)
- frames the minimum tests as low-effort, making 'zero tests' a poor trade-off
A business stakeholder asks for 'real-time' dashboards for a metric that's currently refreshed via a nightly batch job. What questions would you ask before committing to a streaming rewrite?
The most important question is what decision depends on seeing this number sooner, and how much sooner really matters — 'real-time' is often used loosely to mean 'faster than it currently is,' and the honest answer frequently turns out to be an hourly or even 15-minute refresh, which a more frequent batch job can deliver with a fraction of the engineering and operational cost of a genuine streaming pipeline. A second question worth asking directly is whether the stakeholder has thought through what 'real-time' costs in return — streaming pipelines are meaningfully more complex to build, test, and operate (handling out-of-order and late data, managing continuously-running infrastructure rather than scheduled jobs, debugging issues that are harder to reproduce than a batch run with a fixed input) — and whether that cost is truly justified by the specific decision this metric informs. If true low-latency streaming is required — because the decision itself is time-sensitive at that scale, like a fraud-detection trigger — that's a legitimate case for the investment; the goal of asking first is making sure the decision, not just the word 'real-time,' is what's really driving the architecture choice.
What interviewers look for
- proposes clarifying the real latency requirement behind the word 'real-time'
- names a frequent-batch alternative as often sufficient and cheaper
- names concrete real costs of streaming (complexity, operational burden) as part of the trade-off
In a streaming pipeline, what does 'late-arriving data' mean, and why can't a streaming system just wait indefinitely for every possible late event before finalizing a windowed aggregate?
Late-arriving data is an event whose occurrence time is earlier than when the streaming system received it — a mobile app logging an event offline and syncing it hours later, or a network delay holding up delivery — so by the time it arrives, the time window it logically belongs to may have already been considered complete and reported on. Waiting indefinitely for every possible late event before finalizing any windowed result isn't viable because it would mean never truly finalizing anything — there's no guaranteed upper bound on how late an event could theoretically arrive, so any fixed wait time is a deliberate trade-off, not a guarantee of catching every late event. This is exactly what watermarking addresses: defining an explicit, bounded tolerance for lateness (say, data up to 10 minutes late is still incorporated, anything later than that is dropped or handled separately), which lets the system finalize windowed results at a predictable point rather than waiting forever, accepting that a small, known fraction of very late events won't make it into the original window's result.
What interviewers look for
- correctly defines late-arriving data by event time versus processing time
- correctly explains why indefinite waiting isn't viable (no bound on true lateness)
- correctly explains watermarking as the bounded-tolerance solution
A data quality check fails on a nightly pipeline run because a source system started sending a small percentage of rows with a null value in a field that's never been null before. Should the pipeline fail the whole run, or should it proceed and just flag the issue?
The right answer depends on what that field is used for downstream, which is exactly why a single blanket policy ('always fail' or 'always proceed') for every data quality check tends to be wrong in some cases either way. If the field feeds something where a wrong or missing value causes real downstream harm — a financial calculation, a value a critical dashboard depends on directly — failing the whole run and surfacing the problem immediately is usually correct, since silently loading partially-bad data into a system people trust is worse than a delayed but correct pipeline. If the field is less critical and a small percentage of nulls doesn't meaningfully break downstream usage, proceeding while loudly flagging the anomaly (an alert, a logged warning, a quarantine table holding just the affected rows for later investigation) keeps the pipeline delivering value from the clean majority of the data without blocking everything on an issue that, while worth investigating, doesn't need to stop the whole pipeline right now. Designing quality checks with this severity distinction built in from the start — not every check should have the same failure behavior — avoids both the extreme of a pipeline that's too fragile to tolerate any anomaly and the extreme of one that silently absorbs real problems indefinitely.
What interviewers look for
- rejects a single blanket policy, grounds the answer in downstream impact
- gives a concrete case for failing hard and a concrete case for proceeding with a flag
- proposes designing severity levels into checks from the start
What's 'data drift' in the context of an ongoing pipeline, and why can it break downstream consumers even though no individual pipeline run ever really failed?
Data drift is a gradual change in the statistical properties or structure of data flowing through a pipeline over time — a category that used to represent 2% of rows slowly growing to represent 40%, a numeric field's typical range slowly shifting, a previously-rare value becoming common — none of which necessarily trips a pass/fail threshold on any single run, since the change happens incrementally rather than as one dramatic break any one quality check would catch. This can still break downstream consumers because models, dashboards, and business logic are often built around assumptions that were true when they were designed — a machine learning model trained on historical data with one distribution can degrade in accuracy as the real-world distribution it's scoring drifts away from what it learned, and a dashboard's hardcoded axis scale or a report's assumed 'normal range' can quietly become misleading without any error ever being thrown. Catching drift requires monitoring trends over time rather than just pass/fail checks on each individual run — tracking a field's distribution or a category's proportion across weeks or months and alerting on a meaningful trend, not just a single-run anomaly, is what surfaces drift before it causes a real downstream problem.
What interviewers look for
- correctly defines drift as gradual, cumulative change, distinct from a one-time anomaly
- explains why drift evades per-run pass/fail checks
- proposes trend-based monitoring over time as the detection mechanism
What's the practical difference between a cloud data warehouse's storage cost and its compute cost, and why does that separation matter for pipeline design?
Modern cloud data warehouses generally separate storage (holding the data, billed by volume) from compute (running queries against it, billed by usage, often per query or per unit of compute time) — a design departure from older systems where storage and compute were bundled together on the same fixed hardware regardless of whether it was actively being used. This separation matters for pipeline design because it changes what's expensive: keeping large volumes of historical data around is comparatively cheap, but running inefficient queries against it repeatedly is where real cost accumulates, which shifts the optimization priority toward query efficiency and avoiding unnecessary full scans rather than toward minimizing how much historical data is retained. It also means compute can scale independently of storage — a workload needing a short burst of heavy processing can spin up more compute temporarily without needing to resize how data is stored, and scaling back down afterward stops that specific cost immediately, which is a different cost model than provisioning a fixed-size cluster sized for peak load that sits underutilized most of the time.
What interviewers look for
- correctly explains the storage/compute separation and independent billing
- correctly explains why this shifts optimization priority toward query efficiency
- explains the independent-scaling benefit this separation enables
A teammate uses an AI coding assistant to generate an Airflow DAG, and it includes several tasks with no retry configuration and no alerting on failure. What's the real risk in accepting this as-is?
An AI assistant tends to generate a DAG that correctly represents the stated task dependencies and logic — the part of the request it was explicitly asked about — while omitting the kind of operational hardening (retries for transient failures, alerting so a failure is noticed, idempotency considerations for safe re-runs) that wasn't explicitly requested and isn't always obvious is missing just from reading through the generated code, since the DAG looks complete and will run successfully in a first test. The real risk surfaces later, in production: a transient failure that a simple retry would have resolved instead fails the whole run with no automatic recovery, and without alerting configured, nobody finds out a scheduled pipeline silently stopped updating until a downstream consumer notices stale data, by which point real decisions may already have been made on outdated information. Treating operational hardening as a required checklist item for any new DAG — regardless of whether it was AI-generated or hand-written — rather than something added only if explicitly remembered closes this gap; the fix isn't distrusting AI-generated DAGs, it's applying the same production-readiness standard to every DAG equally.
What interviewers look for
- correctly identifies the omission pattern — logic present, operational hardening absent
- explains the concrete downstream risk (silent failure, stale data reaching decisions)
- proposes a standard checklist applied equally, not AI-specific distrust
An AI tool offers to auto-generate dbt tests for every model in a project in one pass. What's a reasonable way to evaluate the generated tests before relying on them?
Auto-generated tests can easily satisfy the letter of 'this model has tests' while missing the tests that matter for that specific model's real risk — a generic uniqueness test on an obvious id column is useful but comparatively low-value if the model's real fragile point is a business rule (a status field that should only ever take one of four specific values, a calculated margin that should never be negative) which a generic test-generation pass has no way to know about without being told. Reviewing the generated tests against the specific ways that model could realistically break — not just checking that some tests exist — is the real evaluation step, and it usually surfaces gaps: a generated test suite covering structural properties (nulls, uniqueness, referential integrity) while missing the business-logic invariants that only someone who understands what the model represents would know to check for. Treating the generated tests as a useful, fast-to-produce baseline that still needs deliberate business-logic tests added on top, rather than a complete substitute for thinking through this specific model's risk, gets the real benefit of the speed without the false confidence of assuming generic coverage is sufficient coverage.
What interviewers look for
- distinguishes generic structural tests from model-specific business-logic tests
- explains why auto-generation can't know business rules it wasn't told
- proposes treating generated tests as a baseline needing deliberate additions, not a complete substitute
Senior
A data warehouse table partitioned by date grows to billions of rows, and queries filtering on a recent date range are still slow despite partitioning. What would you investigate?
Partitioning only helps if the query prunes to the relevant partitions — the first thing to check is whether the filter is written in a way the query engine can map directly to the partition key (a literal date range, or a function the engine recognizes as partition-aligned), since a filter expressed in a transformed or indirect way (filtering on a derived timestamp column instead of the literal partition column, for instance) can silently force a full scan across every partition regardless of how the data is physically organized. Beyond partition pruning, checking whether the table's file sizes within each partition are reasonably sized (many data warehouses degrade badly with either too many tiny files or a few enormous ones per partition) and whether statistics used by the query planner are current both matter — stale statistics can lead the optimizer to choose a poor execution plan even when pruning itself is working correctly. Clustering or sorting data within each partition by a secondary commonly-filtered column, where supported, further narrows what needs scanning once partition pruning has already done its coarser-grained filtering.
What interviewers look for
- correctly identifies partition pruning failure as the primary thing to check
- explains a concrete way pruning can silently fail (filter not aligned with partition key)
- mentions file-size/statistics health or secondary clustering as additional real factors
A fact table needs to support both a daily aggregated view for dashboards and detailed row-level data for ad hoc investigation, and the current design forces every dashboard query to aggregate billions of raw rows live. How would you remodel this?
The underlying issue is serving two different workloads — fast, predictable dashboard aggregates and flexible, occasionally-needed row-level drill-down — from a single table shape optimized for neither particularly well. A layered model addresses this directly: keeping the detailed, row-level fact table as the source of truth for ad hoc investigation, while building a separate, pre-aggregated summary table (rolled up to the daily grain dashboards need) that's populated on a schedule or incrementally as new raw data arrives, so dashboard queries read from a table that's already small and pre-computed rather than aggregating billions of rows on every single page load. This is a deliberate, controlled form of denormalization and redundancy — the same underlying facts exist in two shapes for two different access patterns — which is a reasonable trade in a warehouse because storage is comparatively cheap relative to the cost of repeatedly recomputing the same aggregation live. The real design discipline is keeping the aggregation logic that builds the summary table in exactly one place and well-tested, since a dashboard aggregate that drifts out of sync with what the detailed table would produce is a correctness bug waiting to surface.
What interviewers look for
- correctly identifies the two different workloads needing different table shapes
- proposes a pre-aggregated summary table alongside the detailed fact table
- flags the real risk: the aggregation logic drifting out of sync with the source of truth
A long-running Spark job occasionally fails with out-of-memory errors on a specific stage, even though the cluster has plenty of total memory available across all executors. How would you diagnose and address this?
Total cluster memory being plentiful doesn't help if the memory a single executor needs for its slice of work exceeds what's allocated to that one executor — each executor operates within its own fixed memory budget, so an out-of-memory error on a specific stage usually points at either data skew (one partition holding far more data than the others, exceeding that one executor's budget while every other executor's partition fits comfortably) or an operation that needs to hold an unusually large amount of data in memory at once, like collecting a large result to the driver or an unbalanced join. Checking the Spark UI's stage and task breakdown for that specific failing stage — looking at per-task input size and shuffle read size — usually reveals whether a small number of tasks are handling disproportionately large partitions, confirming skew rather than a genuine overall memory shortage. Depending on which it is, the fix is either addressing the skew directly (salting the key, isolating a dominant value), increasing per-executor memory if the workload needs more and skew isn't the cause, or restructuring an operation that unnecessarily concentrates too much data onto one executor or the driver.
What interviewers look for
- correctly explains per-executor memory budgets, not total cluster memory, as the real constraint
- proposes checking the Spark UI's per-task breakdown to distinguish skew from a genuine shortage
- gives a correct, differentiated fix depending on which cause it turns out to be
A team wants to migrate a batch Spark pipeline to also support near-real-time processing using Structured Streaming, reusing as much existing transformation logic as possible. What would you need to change, and what stays the same?
Structured Streaming is designed so the same DataFrame transformation logic — filters, joins, aggregations — written for batch can largely be reused unchanged against a streaming source, since both batch and streaming DataFrames share the same core API; the transformation code itself is often the part that migrates with the least change. What changes is everything around the read and write boundaries: the input shifts from a bounded batch source (reading a complete file or table once) to an unbounded streaming source (continuously reading new data as it arrives, often from a message queue or a continuously-appended file location), and the output shifts from a single final write to a defined output mode (append, update, or complete) describing how results should be written as new data continuously arrives, along with a trigger interval controlling how often a new micro-batch is processed. Aggregations that depend on data arriving within a bounded time window also need explicit watermarking configured — a tolerance for how late data is allowed to arrive before Spark considers a window closed and finalizes its result — which has no equivalent concept in batch processing at all, since batch assumes all relevant data is already present before processing starts.
What interviewers look for
- correctly explains the core transformation API is shared between batch and streaming
- correctly identifies the read/write boundary and output mode as what changes
- mentions watermarking as a new streaming-only concept with no batch equivalent
An organization runs hundreds of DAGs on one Airflow instance, and the scheduler itself has started lagging — tasks are queued but not picked up promptly even when the cluster has free worker capacity. What would you investigate?
Scheduler lag with idle worker capacity available points at the scheduler's own processing loop being the bottleneck, not the workers — the scheduler has to parse every DAG file, evaluate dependencies, and decide what's ready to run on every scheduling cycle, and at a few hundred DAGs, inefficiencies that were invisible at a smaller scale (slow DAG file parsing, overly complex dependency logic evaluated repeatedly, too many tasks packed into very large DAGs) can really saturate the scheduler's own throughput well before worker capacity becomes the limiting factor. Checking DAG parsing time (Airflow exposes metrics for this) usually reveals whether a handful of DAGs with unusually slow or expensive top-level code (import-time database calls, complex dynamic DAG generation logic) are disproportionately eating scheduler cycles meant to be shared across every DAG. Scaling the scheduler itself (where supported, running multiple scheduler replicas) addresses raw throughput, but fixing slow-to-parse DAG files and splitting an overly monolithic DAG into smaller, independently-schedulable ones usually matters more at this scale than simply adding scheduler capacity on top of an underlying inefficiency.
What interviewers look for
- correctly identifies the scheduler's own processing loop as the likely bottleneck, not workers
- proposes checking DAG parsing time/metrics as the concrete diagnostic
- distinguishes scaling the scheduler from fixing slow/monolithic DAGs
A dbt project has grown to hundreds of models with deeply nested dependencies, and a single source change now triggers a full rebuild that takes hours. How would you reduce this without losing correctness?
The first lever is making sure the project is leaning on incremental models wherever a full historical rebuild isn't required on every run — many large, slow-to-rebuild models in a project that's grown organically over time were set up as
table materializations early on and never revisited once incremental processing would clearly pay off at the current data volume. Beyond materialization choices, using dbt's selection syntax to run only the models affected by a given change (state-based selection against what really changed, rather than always running the full DAG) during normal development and CI cuts wasted rebuild time dramatically, reserving full rebuilds for situations that really require them, like a schema change affecting a foundational upstream model. Restructuring overly deep dependency chains — checking whether some models are serialized unnecessarily when they could run in parallel, and whether a few foundational models are bottlenecking everything downstream of them — often reveals real parallelization opportunities the DAG's current shape isn't exploiting. None of this should come at the cost of correctness: incremental logic needs its own tests confirming it produces the same result as a full rebuild would, since an incorrectly implemented incremental model is a believable-looking but wrong result, which is a worse failure mode than a slow but correct one.What interviewers look for
- proposes auditing materialization choices for models that should be incremental
- proposes state-based/selective model runs rather than always running the full DAG
- insists incremental correctness is tested, not just assumed
A company runs both a batch pipeline (for historical reporting) and a streaming pipeline (for live dashboards) computing what's supposed to be the same underlying metric, and the two occasionally disagree. How would you approach reconciling this architecturally, not just patching the discrepancy once?
Maintaining two independently-written implementations of the same business logic — one in the batch pipeline's code, one in the streaming pipeline's code — is itself the structural problem; a discrepancy today is a predictable consequence of that duplication, not a one-off bug to patch. The deeper fix is converging on a single source of truth for the transformation logic wherever the engine allows it — some frameworks (Spark's Structured Streaming, among others) support writing the same core transformation code against both a bounded batch source and an unbounded streaming source, removing the duplication at its root. Where unifying the code isn't practical with the current toolset, the more modest fallback is testing that both implementations produce identical results against the same historical data on a regular, automated basis — turning 'we noticed a discrepancy' into a monitored invariant instead of something only surfaced when a stakeholder compares both dashboards. The anti-pattern worth avoiding is fixing today's specific cause without addressing why two independent implementations were allowed to drift apart in the first place.
What interviewers look for
- correctly identifies dual independent implementations as the structural problem, not just today's bug
- proposes a unified-code approach (shared batch/streaming logic) as the deeper fix where feasible
- proposes an automated batch-vs-streaming parity check as the fallback when unification isn't practical
An organization has data quality checks scattered across dbt tests, ad hoc scripts, and a few dashboards manually eyeballed by analysts, with no single place showing overall data health. How would you approach consolidating this?
Scattered checks with no central visibility mean a failure in one place often goes unnoticed by anyone not looking at that exact script's output, and there's no way to answer a simple question like 'is our data healthy right now' without manually checking several disconnected places — which usually means nobody does, until a downstream consumer notices something is wrong. The architectural fix is less about inventing new checks and more about centralizing visibility: routing every check's result — whether it originates in dbt tests, a custom script, or anywhere else — into one common observability layer (a dedicated data quality tool, or even a simple shared results table with consistent severity and timestamp fields) that can be queried and alerted on consistently, regardless of which system originally ran the check. From there, defining clear ownership (who gets paged when a specific check fails) and a severity taxonomy that's enforced, not just aspirational, turns data quality from something a handful of people informally watch for into something the organization can systematically trust or distrust based on visible, current signal, rather than everyone's individual experience of how often they've personally noticed something wrong lately.
What interviewers look for
- correctly identifies the lack of centralized visibility as the real problem, not just missing checks
- proposes routing every check's result into one common observability layer
- proposes clear ownership/alerting, not just a dashboard nobody is responsible for watching
A team's cloud data warehouse bill has grown significantly month over month, and nobody can clearly explain which specific queries or teams are driving the increase. How would you approach diagnosing and controlling this?
The first gap to close is visibility: most cloud warehouses expose query-level cost and usage metadata (which user ran a query, how much it scanned, how long it took), and without that being actively reviewed, the organization is effectively flying blind on cost regardless of how the warehouse itself is configured. A regular report surfacing the most expensive queries and the teams or pipelines behind them — not just the total bill — turns a vague 'costs are rising' concern into specific, actionable targets, since a small number of expensive queries are usually responsible for a disproportionate share of total cost. Concrete levers from there include catching queries that scan far more data than needed (missing partition filters, a
SELECT * where only a few columns are used), setting usage quotas or cost alerts per team so a spike is caught quickly, and auditing whether scheduled jobs run more often than their real freshness need justifies. The organizational piece — making cost visible and attributable — usually matters more long-term than any single query-level fix, since it changes the incentive for teams to notice their own expensive patterns.What interviewers look for
- proposes query-level cost visibility as the first real gap to close
- proposes attributing cost to specific teams/queries, not just tracking the total bill
- names concrete levers (scan reduction, quotas/alerts, review of unnecessary job frequency)
An organization is deciding whether to migrate from one cloud data warehouse vendor to another, expecting better performance and lower cost. What would you want evaluated before committing, beyond a vendor's own benchmark claims?
Vendor-published benchmarks showcase that vendor's specific strengths, so they rarely predict how a different organization's own query patterns, data volumes, and concurrency will perform on the same platform — the only benchmark that reliably predicts real cost and performance is running this organization's own representative workloads directly against the candidate platform, not a synthetic or vendor-provided test. Beyond raw performance, migration cost deserves honest evaluation: how much existing SQL, dbt models, and pipeline code would need rewriting for differences between the two platforms, how long a realistic migration and validation period would take, and the risk of running both systems in parallel during that transition — all real costs a simple performance-per-dollar comparison easily omits. Factoring in lock-in and a second migration's switching cost down the line, and whether the expected savings justify the disruption versus just optimizing the current platform first, keeps the evaluation honest rather than assuming migration is the right call just because a benchmark looks favorable on paper.
What interviewers look for
- correctly identifies vendor benchmarks as unreliable for predicting this org's real performance
- proposes testing with the organization's own representative workload directly
- names real migration costs (rewrite effort, transition risk, lock-in) as part of the honest evaluation
Your organization is considering an AI tool that automatically proposes schema changes and query optimizations directly against the production warehouse based on observed usage patterns. What governance would you want in place before allowing that?
Letting a tool act directly on a production schema based on its own inferred usage patterns introduces a different risk category than a tool that merely suggests changes for a human to review and apply — an inferred pattern can be wrong (a query that looks unused because it's run quarterly, not never) or incomplete (missing a downstream dependency the tool's usage analysis didn't capture), and a schema change that seemed locally reasonable based on observed patterns can break something the tool had no visibility into at all. The baseline governance worth insisting on is that any proposed change goes through the same review and approval process as a human-proposed schema or query change — proposed, reviewed by someone with real context on downstream dependencies, and applied deliberately — never auto-applied directly based on the tool's own confidence in its recommendation, regardless of how statistically sound its usage analysis appears. Beyond that, maintaining a clear audit trail distinguishing which changes originated from the tool versus a human, and being able to cleanly roll back a batch of tool-proposed changes if a downstream issue surfaces later, keeps the arrangement accountable and reversible rather than trusting the tool's pattern-matching as equivalent to a human's broader context on the system.
What interviewers look for
- correctly identifies the risk category difference between suggesting and auto-applying
- insists on human review before any change is applied, regardless of the tool's confidence
- proposes auditability and rollback for tool-originated changes

