By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.
A data pipeline is a repeatable, automated workflow that moves raw data from source systems through ETL (Extract → Transform → Load) or ELT (Extract → Load → Transform) steps, delivering clean, feature‑ready tables for modeling. In a data‑science project the pipeline guarantees that the same preprocessing logic is applied every time you train, validate, or serve a model, eliminating “it works on my laptop” bugs.
Real‑world example: An e‑commerce platform extracts daily click‑stream logs, enriches them with user‑profile data, aggregates to daily sessions, and loads the result into a feature store. A churn‑prediction model then reads the latest features each night to score customers for targeted retention campaigns.
pd.read_sql(query, conn)
spark.read.format("json").load(path)
df['price'] = df['price'].astype(float)
df = df.dropna(subset=['user_id'])
df.to_parquet('s3://ml‑features/daily.parquet')
MERGE INTO target USING source ON key
expect_column_values_to_be_between(df, "age", 0, 120)
pytest
pytest‑mock
python # Example: pull daily logs from S3 and user table from Postgres logs = spark.read.json("s3://raw/logs/2024-05-28/*.json") users = pd.read_sql("SELECT * FROM users", pg_conn)
python # Join, fill missing, create session length df = logs.join(users, "user_id", "inner") df = df.fillna({"country": "UNKNOWN"}) df = df.withColumn("session_len", F.unix_timestamp("end") - F.unix_timestamp("start"))
python df.write.format("delta").mode("overwrite").partitionBy("date").save("/mnt/feature_store/daily")
Mistake: Hard‑coding file paths or dates. Correction: Parameterize paths (e.g., {{ ds }} in Airflow) and use relative timestamps so the pipeline works for any run date.
{{ ds }}
Mistake: Running transformations on the source system (e.g., heavy joins in MySQL). Correction: Offload heavy compute to Spark/Databricks or a cloud warehouse; keep source DB for simple extracts only.
Mistake: Skipping data‑validation and assuming “clean” data. Correction: Add automated expectations; a single bad row can crash downstream training or cause model drift.
Mistake: Loading transformed data into a different schema than the training code expects. Correction: Enforce a contract (e.g., JSON schema or protobuf) and version it; update both training and serving code together.
Mistake: Treating the pipeline as “set‑and‑forget” and never monitoring latency or failures. Correction: Hook Airflow alerts to Slack/PagerDuty and log metrics (run time, row counts) to a monitoring dashboard.
ETL vs. ELT – When to pick which? Interviewers expect you to say: ETL when the target system cannot handle raw data or when you need row‑level security before loading; ELT when you have a cloud data lake/warehouse that can scale compute and you want to keep the raw data for future experiments.
Batch vs. Streaming – Trade‑offs Be ready to discuss latency (streaming < seconds), complexity (streaming needs stateful processing), and consistency guarantees (exactly‑once vs at‑least‑once).
Feature Store Benefits Explain how a feature store eliminates “training‑serving skew” by guaranteeing the same code path for offline and online feature generation.
Idempotency & Re‑runnability Interviewers love hearing about upserts (MERGE) and checkpointing in Spark Structured Streaming to guarantee exactly‑once semantics.
MERGE
Scenario: Your nightly pipeline fails because a new column promo_code appears in the raw logs. Answer: Add schema evolution handling (e.g., enable spark.sql.autoMergeSchema=true or update the Delta table schema). Why: Without schema evolution the write will abort, breaking downstream jobs.
promo_code
spark.sql.autoMergeSchema=true
Scenario: You need to serve churn predictions in real time, but your feature engineering currently runs in a nightly batch job. Answer: Move the critical features to an online feature store (e.g., Redis or DynamoDB) and compute them incrementally as events arrive. Why: Real‑time inference requires low‑latency feature retrieval, not batch‑only data.
Scenario: After adding a new join, the pipeline runtime jumps from 5 min to 45 min. Answer: Push the heavy join to the ELT stage using a distributed engine (Spark/BigQuery) or pre‑aggregate the join keys. Why: Scaling compute on the target system is faster than doing the join on a single‑node source DB.
expect_column_values_to_be_unique(df, "order_id")
depends_on_past=False
StandardScaler
MinMaxScaler
spark.sql.autoMergeSchema = true
flake8
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.