BetaJobprepping.com is in beta and still under construction. New sign-ups are closed.
Start practising
Data Engineer

28 Data Engineer Interview Questions with Answers

28 Data Engineer interview questions on SQL, Python, pipeline design, modelling and incidents, each with a strong answer, a weak one and the follow-up.

Updated

Data Engineer interview questions fall into six groups: your past pipelines and incidents, SQL on messy data, Python transformations, pipeline and system design, data modelling, and reliability and stakeholder scenarios. Interviewers care less about syntax than about correctness under stress: late records, retries, duplicates and schema changes. Below are 28 practice questions we wrote, each with why it is asked, a strong answer, a weak answer and the likely follow-up.

For how the whole loop is structured, read the data engineer interview guide. Work through them with the two-week data engineer prep plan.

How data engineer question types map to the interview loop#

Most loops run a recruiter screen, a technical screen, then three to five final-round interviews:

  • Technical screen: SQL first, sometimes Python, often in a shared editor such as CoderPad or HackerRank.
  • Coding round: Python transformations on records (dictionaries, sorting, time zones, generators), rarely graph puzzles.
  • Pipeline or system design: ingestion, batch versus streaming, storage layout, orchestration, backfills and data quality.
  • Data modelling: grain, keys, facts, dimensions and history. In some loops the modelling, SQL and Python rounds share one product scenario, so a wrong grain early costs you in every later step.
  • Incident or data quality round: a broken dashboard or a row-count drop, scored on triage order and communication.
  • Behavioural or ownership: incidents, disagreements, things you fixed without being asked.

Data engineer behavioral interview questions#

1. Walk me through a pipeline you built end to end#

  • Why it is asked: the rest of the interview's follow-ups come from what you say here.
  • Strong answer: volume, freshness target and consumers in the first 30 seconds, then the decision that mattered. "About 40 million events a day, landed hourly, used by finance for revenue recognition. The key decision was keeping raw events immutable in object storage so we could rebuild any table."
  • Weak answer: a tour of tools ("Kafka, then Spark, then Snowflake") with no numbers.
  • Follow-up: "What would break first at ten times the volume?"

2. Tell me about a data incident you caused#

  • Why it is asked: everyone who runs pipelines has broken one; claiming otherwise is a red flag.
  • Strong answer: STAR outline. Situation: a dedupe change shipped on a Friday. Task: the revenue table over-counted by 3% for two days. Action: rolled back, reran the affected partitions, told finance the exact date range. Result: a row-count reconciliation against the source now blocks publication.
  • Weak answer: a story where an upstream team was at fault and you only noticed.
  • Follow-up: "How did downstream users find out, and how quickly?"

3. Describe a time you said no to a stakeholder request#

  • Why it is asked: saying yes to every one-off extract produces an unmaintainable, leaky platform.
  • Strong answer: the request, the cost and the alternative. "Sales asked for a per-rep extract emailed every morning. Emailed files went stale and ended up in personal inboxes, so I offered a governed table in the BI tool with row-level security on each rep's territory. Reps got fresher numbers and we could revoke access when someone left."
  • Weak answer: "I explained it was not possible", with no alternative.
  • Follow-up: "What would have made you say yes?"

4. What is the messiest source system you have integrated?#

  • Why it is asked: it shows whether you read data before trusting documentation.
  • Strong answer: specific defects and the handling of each: a CRM that reused deleted IDs, local timestamps without an offset, a "status" field with 14 spellings. Profiling first, then a contract or validation step.
  • Weak answer: "The data was dirty so I cleaned it."
  • Follow-up: "Which problems did you push back to the source team, and which did you absorb?"

5. Tell me about a cost or performance improvement you made#

  • Why it is asked: warehouse and cluster bills are visible to leadership, and the interviewer wants a measured before and after.
  • Strong answer: baseline, cause, change, result. "A daily job scanned the full 4 TB table because it filtered on a derived date. We partitioned on event date and pushed the filter down; runtime fell from 70 to 9 minutes."
  • Weak answer: "I optimised the queries", with no numbers.
  • Follow-up: "How did you stop anyone reintroducing the full scan?"

SQL interview questions for data engineers#

6. Find each customer's first and most recent order in one pass#

  • Why it is asked: it tests aggregation and whether you avoid self-joins.
  • Strong answer: a single GROUP BY, after asking whether cancelled orders count.
SELECT customer_id,
       MIN(ordered_at) AS first_order_at,
       MAX(ordered_at) AS latest_order_at,
       COUNT(*)        AS orders
FROM orders
WHERE status <> 'cancelled'
GROUP BY customer_id;
  • Weak answer: two subqueries joined back together.
  • Follow-up: "Now return the full row of the latest order." That needs ROW_NUMBER() with a tie-breaker such as order_id DESC.

7. Why does this join return more revenue than the orders table holds?#

  • Why it is asked: fan-out joins are the most common silent SQL bug in pipelines.
  • Strong answer: spots that joining orders to a one-to-many table repeats each order row. The bug:
SELECT SUM(o.amount), SUM(p.paid)
FROM orders o
JOIN payments p ON p.order_id = o.order_id;  -- 3 instalments, order counted 3 times

The fix aggregates the many side to the order grain first:

WITH p AS (
  SELECT order_id, SUM(paid) AS paid
  FROM payments
  GROUP BY order_id
)
SELECT SUM(o.amount) AS order_value, SUM(p.paid) AS paid
FROM orders o
LEFT JOIN p USING (order_id);

The LEFT JOIN keeps unpaid orders, which an inner join would silently drop.

  • Weak answer: adding DISTINCT until the number looks right.
  • Follow-up: "How would a test catch this?" Assert that row count and summed value at the order grain match the source.

8. Compute a 7-day rolling count of active users#

  • Why it is asked: it tests ROWS versus RANGE frames and missing days.
  • Strong answer: notes that ROWS BETWEEN 6 PRECEDING AND CURRENT ROW counts seven rows, not seven days. A window is also a poor way to count distinct users here: PostgreSQL and Spark SQL reject COUNT(DISTINCT) as a window function, and support in other engines varies. The portable answer joins on a date range:
WITH days AS (SELECT DISTINCT activity_date AS d FROM user_activity)
SELECT days.d, COUNT(DISTINCT a.user_id) AS active_7d
FROM days
JOIN user_activity a
  ON a.activity_date >  days.d - INTERVAL '7 days'
 AND a.activity_date <= days.d
GROUP BY days.d;

If some days have no activity, replace days with a generated calendar (generate_series in PostgreSQL, GENERATE_DATE_ARRAY in BigQuery) and use a LEFT JOIN so those days report zero.

  • Weak answer: a rows frame over a table with missing days.
  • Follow-up: "This runs over two billion rows. How do you make it incremental?" Pre-aggregate one row per user per day, then recompute only the last seven output days.

9. Write an idempotent upsert into a target table#

  • Why it is asked: retries are routine, and appending on every run doubles data.
  • Strong answer: MERGE (Snowflake, BigQuery, Delta Lake, Apache Iceberg via Spark SQL, PostgreSQL 15 onwards) on the natural key, updating only when the incoming record is newer.
MERGE INTO dim_product AS t
USING staged_product AS s
  ON t.product_id = s.product_id
WHEN MATCHED AND s.source_updated_at > t.source_updated_at THEN
  UPDATE SET name = s.name, price = s.price,
             source_updated_at = s.source_updated_at
WHEN NOT MATCHED THEN
  INSERT (product_id, name, price, source_updated_at)
  VALUES (s.product_id, s.name, s.price, s.source_updated_at);
  • Weak answer: INSERT, then a dedupe job afterwards.
  • Follow-up: "The staged batch has the same key twice. What happens?" If the key already exists in the target, most engines fail the merge. If it is new, both rows are usually inserted with no error. Either way, dedupe the source to one row per key first.

Python coding interview questions for data engineers#

10. Deduplicate records where the latest version wins#

  • Why it is asked: it shows whether you define the ordering rule before coding; an undefined "latest" causes most double-counted ingestion.
  • Strong answer: "Key is order_id; latest means highest updated_at, and on a tie the highest source sequence number." Then one pass:
latest = {}
for r in records:
    k = r["order_id"]
    rank = (r["updated_at"], r["seq"])
    if k not in latest or rank > latest[k][0]:
        latest[k] = (rank, r)
result = [r for _, r in latest.values()]
  • Weak answer: sorting everything and taking the last item, with no tie rule.
  • Follow-up: "Records arrive out of order across several files. Does it still hold?" Yes, because the comparison never depends on arrival order.

11. Convert timestamps from mixed sources into UTC#

  • Why it is asked: time zone bugs produce wrong daily totals around daylight saving changes.
  • Strong answer: zoneinfo (standard library since Python 3.9) for named zones, refusing naive timestamps unless the source's zone is known, and noting that a local day around a clock change has 23 or 25 hours.
  • Weak answer: adding a fixed hour offset.
  • Follow-up: "During the autumn change one local hour repeats. How do you disambiguate?" Mention the fold attribute and asking the source for a sequence number.

12. Write a retry wrapper for a flaky API call#

  • Why it is asked: it shows whether you separate retryable from non-retryable errors and protect the sink from duplicate writes.
  • Strong answer: exponential backoff with jitter, capped attempts, retries only on timeouts, HTTP 429 and 5xx, and honours Retry-After:
RETRYABLE = {429, 500, 502, 503, 504}

def get_with_retry(url, attempts=5, base=0.5, cap=30):
    for attempt in range(attempts):
        try:
            resp = requests.get(url, timeout=10)
        except requests.Timeout:
            resp = None
        if resp is not None and resp.status_code not in RETRYABLE:
            resp.raise_for_status()  # a 400 or 404 fails at once
            return resp
        if attempt == attempts - 1:
            raise RuntimeError("retries exhausted")
        header = resp.headers.get("Retry-After", "") if resp is not None else ""
        delay = min(cap, base * 2 ** attempt) * random.uniform(0.5, 1)
        time.sleep(float(header) if header.isdigit() else delay)

Make the downstream write idempotent too.

  • Weak answer: while True with time.sleep(1).
  • Follow-up: "How do you test it without the real API?" Inject a fake client that returns 503, 503, then 200.

Data engineering system design interview questions#

13. Design a pipeline for payment events feeding a finance dashboard and a fraud model#

  • Why it is asked: two consumers with different freshness needs force a real trade-off.
  • Strong answer: clarifies latency first (fraud needs seconds, finance needs correct daily totals by morning). One ingestion stream into Kafka, a streaming path for fraud features, and a batch path that rebuilds daily tables from the same raw events, partitioned by event date and deduped on payment ID.
  • Weak answer: one streaming job for everything, with no plan for corrections.
  • Follow-up: "Finance finds a refund recorded twice last week. How do you correct history?"

14. How do you handle events that arrive days late?#

  • Why it is asked: late data decides whether totals are ever right.
  • Strong answer: partitions by event time and reprocesses a rolling window of recent partitions each run (say 7 days). In streaming, watermarks with allowed lateness, with later records sent to a side output that a batch correction job picks up.
  • Weak answer: "We drop late events."
  • Follow-up: "How do you size that window?" Measure the arrival-delay distribution and pick the percentile the business accepts.

15. A source schema changes overnight. What should the pipeline do?#

  • Why it is asked: schema drift is routine on any platform with many producers.
  • Strong answer: additive changes (a new nullable column) are usually safe; breaking ones (type change, rename, dropped column) should fail fast or quarantine. Mentions a schema registry with compatibility rules for Kafka topics, Iceberg tracking columns by field ID so renames do not break reads, and a data contract with the producer.
  • Weak answer: "We use schema inference."
  • Follow-up: "The breaking change is live and the producer will not roll back. What now?"

16. Explain exactly-once processing and when you need it#

  • Why it is asked: candidates who say "Kafka gives exactly-once" reveal they have not traced a write to an external sink.
  • Strong answer: "Delivery is usually at-least-once; exactly-once is an end-to-end property. Kafka's idempotent producers and transactions cover writes within Kafka, but an external system needs an idempotent sink, such as a merge on a key or a partition overwrite."
  • Weak answer: "Kafka guarantees exactly-once."
  • Follow-up: "Your sink is an email service. How do you avoid double sends?" Record a send key before calling the service and skip keys already present.

17. How would you backfill three years of a table without disrupting the daily run?#

  • Why it is asked: backfills test idempotency and resource planning together.
  • Strong answer: writes to a separate table or branch, processes date ranges in parallel chunks with a concurrency limit, overwrites whole partitions, compares counts and key aggregates against the old table, then swaps.
  • Weak answer: "Rerun the job with an earlier start date."
  • Follow-up: "Halfway through, you find a bug in the new logic. What about the partitions already written?"

18. Why does one Spark task run for an hour while the others finish in a minute?#

  • Why it is asked: skew is the classic distributed processing problem.
  • Strong answer: confirms in the Spark UI stage view that one partition is far larger, finds the hot key (often a null or default value), then picks a fix: handle nulls separately, broadcast the small side, rely on adaptive query execution's skew join handling (AQE is on by default since Spark 3.2), or salt the key. Salting appends a random suffix 0 to N-1 to the hot key on the large side and copies each small-side row once per suffix, so one hot partition becomes N. A task running 50 times the median suggests N of about 20 to 50.
  • Weak answer: "Add more executors."
  • Follow-up: "Why do more executors not help?" One key still lands on one task.

19. Your lake table has 2 million files of 50 KB each and queries are slow. Why, and what do you do?#

  • Why it is asked: the small-files problem is what storage layout questions are really about.
  • Strong answer: per-file open and metadata overhead dominates, not data volume. Compact to roughly 128 MB to 1 GB files (Iceberg's rewrite_data_files procedure, Delta Lake's OPTIMIZE), then fix the cause: partitioning on a high-cardinality column such as user ID, or streaming commits every few seconds. Partition on event date and cluster within it on the column people filter by.
  • Weak answer: "Add more compute."
  • Follow-up: "Compaction conflicts with the streaming writer. How do you schedule it?"

20. Design an Airflow workflow for a daily load that depends on three upstream sources#

  • Why it is asked: orchestration is where idempotency meets scheduling.
  • Strong answer: one extract task per source, each behind a deferrable sensor so waiting does not hold a worker slot. Every task writes the partition for data_interval_start, never now(), so rerunning 3 March rewrites exactly 3 March. Retries with backoff on extracts, publish only after checks pass, and a freshness alert if the table has not landed by 07:00. In Dagster the same design becomes partitioned assets.
  • Weak answer: one task running a script that loads "yesterday".
  • Follow-up: "One source is two days late. What happens on each of those days?"

Data modeling interview questions for data engineers#

21. How would you model a ride-hailing business for analytics?#

  • Why it is asked: it tests grain and dimensional thinking.
  • Strong answer: starts from business questions (trips per city, driver earnings, cancellations), picks the business process (trip requests), declares the grain ("one row per trip request"), then dimensions (rider, driver, city, date, vehicle type) and facts (fare, distance, wait time). This is Kimball's four-step process from "The Data Warehouse Toolkit".
  • Weak answer: one wide table with every column the app emits.
  • Follow-up: "Product wants drivers' idle time. Can your model answer it?"

22. A correction to a customer's region arrives backdated to last March. What changes in your type 2 dimension?#

  • Why it is asked: type 2 history is easy until changes arrive late or out of order.
  • Strong answer: inserts the new version from March, closes the version current then, and re-chains later versions so half-open ranges never overlap. Facts that captured a surrogate key at load now point at the wrong version, so either reprocess those partitions or resolve the version at query time:
JOIN dim_customer d
  ON d.customer_id = f.customer_id
 AND f.ordered_at >= d.valid_from
 AND f.ordered_at <  d.valid_to   -- valid_to = '9999-12-31' for the current row
  • Weak answer: "Keep an audit log table", with no way to query it.
  • Follow-up: "Finance has already closed March. Do you restate it?"

23. A fact arrives before its customer dimension row. What do you load?#

  • Why it is asked: late-arriving dimensions break naive key lookups.
  • Strong answer: an inferred member, a placeholder row with a new surrogate key and the natural key, and loads the fact against it. When the real record arrives the placeholder is updated in place, so the fact never needs reloading.
  • Weak answer: dropping the fact or holding it back indefinitely.
  • Follow-up: "How do analysts know which customers are still placeholders?"

24. Star schema or one wide table for a BI tool?#

  • Why it is asked: it tests whether you choose models for users and engines, not by habit.
  • Strong answer: wide tables suit columnar engines such as BigQuery and Snowflake and self-serve users who avoid joins. A star keeps conformed dimensions shared across facts and makes type 2 history possible. Many teams build the star and publish wide marts from it.
  • Weak answer: "Stars are outdated now storage is cheap."
  • Follow-up: "A customer attribute changes. What must be rebuilt in each design?"

25. How would you model an order's lifecycle from placed to delivered?#

  • Why it is asked: it tests whether you know Kimball's three fact table types.
  • Strong answer: an accumulating snapshot fact, one row per order with milestone dates (placed, paid, shipped, delivered) filled in as each happens, so "days from paid to shipped" is a subtraction. A transaction fact of status changes can sit alongside for auditing.
  • Weak answer: status-change rows only, leaving every lag metric to a self-join.
  • Follow-up: "Orders can be returned and reshipped. Does the design hold?"

Reliability and stakeholder scenarios#

26. Yesterday's revenue on a dashboard is down 40%. What do you do in the first 20 minutes?#

  • Why it is asked: this is the on-call reality of the job.
  • Strong answer: freshness first (did the load finish), then completeness (row counts by source and hour against the trailing week), then recent changes (deploys, upstream schema). Marks the dashboard as under investigation and promises its owner a next-update time.
  • Weak answer: rewriting the query first.
  • Follow-up: "The data is correct; a promotion ended. How do you avoid the same panic next time?"

27. What data quality checks would you add to a new table?#

  • Why it is asked: checks show what you think can go wrong.
  • Strong answer: freshness, volume within a band of the trailing average, primary key uniqueness, not-null on required fields, referential integrity, and one business rule such as "a refund never exceeds the original payment". Says which checks (in dbt tests or Great Expectations) block publication and which only alert.
  • Weak answer: null checks on every column.
  • Follow-up: "Your checks fire three times a week, mostly false alarms. What do you change?"

28. An analyst says your table is wrong but cannot say how. What do you do?#

  • Why it is asked: it tests whether you reconcile a definition before touching code, since most "wrong number" reports are definition gaps.
  • Strong answer: asks for one example (a customer, a date, the expected number and its source), reproduces it, and compares definitions, such as gross versus net of refunds. The fix is often documentation and a renamed column.
  • Weak answer: "The pipeline passed its tests, so the data is right."
  • Follow-up: "Both numbers are defensible. Who decides which becomes official?"

How to practise these questions#

Answer each question aloud in under three minutes, then the follow-up without notes. Write SQL and Python with autocomplete turned off, since many screens use a shared editor without it, and open every design answer by asking volume, freshness and consumers.

For the theory behind questions 14 to 18, read the batch processing and stream processing chapters of Martin Kleppmann's "Designing Data-Intensive Applications" (the second edition is co-written with Chris Riccomini); for which certifications are worth it, see things to know before applying.

For pressure closer to the real thing, practise a timed 30, 45 or 60 minute Data Engineer mock interview, with live Python coding and a voice interviewer that follows up on what you actually said.

Frequently asked questions#

What SQL questions do data engineers get asked?#

Data engineers are most often asked to deduplicate to the latest row with ROW_NUMBER, find first and last events per user, compute rolling 7-day actives, write an idempotent MERGE, and explain why a join inflates totals. Each one tests correctness under duplicates, gaps or ties more than syntax, so state the grain and the tie-breaker aloud before you write the query.

Do data engineer interviews include LeetCode-style questions?#

Some large technology companies include one algorithm-style question, but most data engineer coding rounds use practical data tasks instead: parsing files, deduplicating records, merging batches and handling time zones in Python. Practise dictionaries, sorting, generators and the datetime and zoneinfo modules before spending time on dynamic programming or graph problems.

How should I answer data engineering system design questions?#

Start by asking about data volume, freshness, consumers and correctness requirements, then sketch ingestion, storage, processing and serving in that order. Name how you handle late data, retries, schema changes and backfills, because those are where interviewers probe. Finish with monitoring and data quality checks, and state the trade-off you accepted and what would change your mind.

How many questions should I prepare for a data engineer interview?#

Prepare around 25 to 30 questions across all six types, with at least three behavioural stories you can adapt: a pipeline you owned, an incident, and a disagreement with a stakeholder. Depth beats breadth, so for each question rehearse the likely follow-up too, since that is where interviewers decide whether you have run pipelines in production.

Read next

GuideData Engineer

Data Engineer Interview Guide with Questions and Prep Plan

How the data engineer interview works, the pipeline design, coding and SQL skills it scores, 9 practice questions with strong-answer notes and a 7-day plan.

ChecklistData Engineer

16 Things to Know Before Applying for a Data Engineer Job

What to know before applying for a Data Engineer job - the real daily work, must-have skills, certifications, pay data, job-ad red flags and a readiness check.

Prep planData Engineer

How to Prepare for a Data Engineer Interview in 2 Weeks

How to prepare for a data engineer interview in 14 days, with daily SQL sets, pipeline design drills, a story bank, timed mocks and a 3-day crash version.

Practice

Say it out loud.

Reading about an interview isn't the same as doing one. Take a 30, 45 or 60-minute Data Engineer interview with an AI interviewer and get scored against a real rubric.

Choose an interview