Dashboards, analytics and AI are only as good as the data beneath them. This guide explains the core ideas of data engineering, then gives you SOPs for onboarding sources, quality, schema change, failures and privacy, and MOPs for building a batch pipeline, setting up change data capture, safe backfills, schema rollouts, star-schema modelling and streaming, with SQL you can copy.
1. The concepts you need first
Data engineering turns raw data from many systems into trustworthy, timely data that analysts, applications and AI models can use. Most problems come from unclear terms, so start here.
| Concept | What it means | Why it matters |
|---|---|---|
| Data pipeline | Automated steps that move and shape data from sources to a destination. | Replaces manual spreadsheets and one-off scripts. |
| ETL vs ELT | ETL transforms before loading; ELT loads raw data first and transforms inside the warehouse or lakehouse. | ELT is common today because storage and warehouse compute are cheap and flexible, and raw data is kept for reprocessing. |
| Batch vs streaming | Batch processes data in scheduled chunks; streaming processes events continuously. | Choose streaming only when the business needs results in seconds or minutes. Batch is simpler and cheaper. |
| Data lake, warehouse, lakehouse | A lake stores raw files cheaply; a warehouse stores modelled tables for fast SQL; a lakehouse combines both with table formats such as Delta, Iceberg or Hudi. | Decides where data lives and how teams query it. |
| Medallion layers | Bronze (raw, as received), silver (cleaned and conformed), gold (business-ready models). | A simple, widely used structure that keeps raw data safe and models clear. |
| Orchestration | A scheduler (for example Airflow, Dagster, Prefect or a cloud service) that runs tasks in order, retries and alerts. | Dependencies and failures are managed, not hidden in cron jobs. |
| Idempotency | Running a job twice gives the same result as running it once. | Makes retries and backfills safe. The most important pipeline property. |
| CDC (change data capture) | Reading a database's change log to copy inserts, updates and deletes downstream. | Near-real-time replication without heavy queries on the source. |
| Dimensional model | Fact tables (events, such as orders) connected to dimension tables (customer, product, date) in a star schema. | Easy for people and tools to understand and query. |
| Data quality dimensions | Completeness, validity, uniqueness, consistency, timeliness and accuracy. | The checklist for what "good data" means. |
| Data contract | An agreement between data producer and consumer on schema, meaning, quality and freshness. | Stops silent upstream changes from breaking dashboards and models. |
| Metadata, catalog, lineage | Descriptions of data, a searchable inventory, and a map of where data came from and goes. | People find and trust data; you can see what a change will affect. |
| DataOps | Applying DevOps ideas (version control, testing, CI/CD, monitoring) to data work. | Reliable, repeatable delivery of data products. |
2. Principles that keep platforms healthy
- Keep the raw data. Store it unchanged so you can always reprocess when logic or bugs change.
- Make every job idempotent and re-runnable for any date range.
- Test data like code: checks on every run, with failures that stop bad data reaching users.
- Version everything: pipeline code, SQL, schemas and configuration in Git, deployed through CI/CD.
- Name an owner and a purpose for every dataset. Unowned data decays.
- Design for change: schemas will evolve; plan how.
- Treat personal data with care: minimise it, protect it, and delete it when you should (see SOP-5).
- Start simple. A reliable daily batch beats an unreliable real-time system.
3. Standard Operating Procedures (SOPs)
Onboard a new data source
- Purpose
- Bring a new source into the platform safely and with clear ownership.
- Owner
- Data engineering lead with the source system owner
- Trigger
- A business request for new data
- Capture the request: business purpose, data owner, users, sensitivity (does it include personal or financial data?), expected volume and freshness.
- Agree a data contract: schema, field meanings, update schedule, and how changes will be announced.
- Choose the method: scheduled extract, API, file drop or CDC. Prefer read-only access using a dedicated service account.
- Build the ingestion into the bronze layer exactly as received, adding load time and source columns.
- Add automated checks (row counts, not-null keys, freshness) and register the dataset in the catalog with owner and description.
- Review the sensitivity classification with security or privacy; apply masking and access rules before wider use.
- Run in non-production, compare with the source, then promote to production with monitoring and a runbook.
Evidence to keep: The request, signed data contract, catalog entry and test results.
Data quality monitoring
- Purpose
- Find bad data before users do.
- Owner
- Dataset owner with the data engineering team
- Trigger
- Every pipeline run, plus a weekly review
- Define checks per table: freshness (loaded on time), volume (row count within expected range), schema (no unexpected change), validity (allowed values), uniqueness of keys and null rates on critical columns.
- Run checks inside the pipeline. Critical failures stop downstream steps; minor ones raise warnings.
- Send alerts to the owning team with a link to the runbook, not to a shared inbox.
- Quarantine bad records in a separate table instead of dropping them silently.
- Review failed checks weekly, fix root causes and tune thresholds. Publish a simple data-quality scorecard.
Evidence to keep: Check results history and the weekly review notes.
Schema change management
- Purpose
- Change data structures without breaking consumers.
- Owner
- Data engineering lead
- Trigger
- A source or model needs a new, renamed or removed column
- Classify the change: additive (new nullable column, usually safe), breaking (rename, type change, removal).
- Use lineage to list affected pipelines, dashboards and models, and tell their owners.
- For breaking changes, provide both old and new versions for a deprecation period (for example 30 days).
- Apply the change in non-production, run tests and compare outputs.
- Release in the agreed window, monitor checks, and remove the old version only after consumers confirm.
Evidence to keep: Change notice, impact list and test comparison.
Pipeline failure and backfill
- Purpose
- Recover from failures and reprocess data safely.
- Owner
- On-call data engineer
- Trigger
- A pipeline alert or a report of missing or wrong data
- Acknowledge the alert, check the orchestrator and logs, and identify the failing task and the first failure time.
- Decide: retry (temporary fault), fix and rerun (code or data issue), or backfill (data missing for a past period).
- Tell downstream owners if their data will be late or wrong, with an expected fix time.
- Run the fix; for backfills follow MOP-3.
- After recovery, verify with the quality checks and confirm with a key consumer.
- Add a test or alert that would have caught the issue earlier.
Evidence to keep: Incident note, backfill record and the new test.
Access, privacy and retention of personal data
- Purpose
- Protect personal data and meet legal duties.
- Owner
- Data governance lead with the privacy officer
- Trigger
- Any dataset with personal data; every access request; scheduled deletion
- Classify data (public, internal, confidential, personal/sensitive) and label it in the catalog.
- Minimise: collect and keep only what is needed. Pseudonymise or mask identifiers (names, phone numbers, ID numbers) in analytics layers.
- Grant access by role, with approval from the data owner, and review it every quarter. Log who queried sensitive tables.
- Define retention per dataset and delete automatically when it expires, including backups on their own schedule.
- Be able to find and erase or correct one person's data on request. In India, the Digital Personal Data Protection Act, 2023 gives people such rights and requires reasonable security and breach notification, so involve your privacy or legal adviser.
Evidence to keep: Classification records, access logs and deletion logs.
Cost and performance management
- Purpose
- Keep warehouse and storage bills and query times under control.
- Owner
- Platform owner
- Trigger
- Monthly review, and on any cost alert
- Tag compute and storage by team and project; show cost per team monthly.
- Set budgets and alerts; set auto-suspend for idle warehouses and clusters.
- Partition and cluster large tables on commonly filtered columns; use columnar formats such as Parquet; compact small files.
- Find the most expensive queries and jobs, and fix or schedule them off-peak.
- Delete or archive unused tables and old intermediate data.
Evidence to keep: Monthly cost report and the list of optimisations done.
Documentation and catalog hygiene
- Purpose
- Let people find and understand data without asking around.
- Owner
- Data owners
- Trigger
- Every new dataset; quarterly review
- Every table has a description, owner, refresh schedule, and column meanings for key fields.
- Business definitions (for example "active customer") live in one governed place and are reused.
- Retire and mark datasets as deprecated with a replacement pointer.
- Review the catalog quarterly; remove stale entries.
Evidence to keep: Catalog completeness report.
4. Methods of Procedure (MOPs)
Build a reliable daily batch ELT pipeline
- Use when
- A new source needs to reach a warehouse or lakehouse for reporting.
- Source access (read-only), a landing area, a warehouse schema per layer.
- A data contract and agreed refresh time.
- Extract the data for a date window (for example yesterday) into the landing area in a raw format; keep the file or batch id.
- Load to bronze as received plus load metadata (load time, source, batch id).
- Validate before transforming: row count against the source, key not null, expected schema. Stop on critical failure.
- Transform to silver: cast types, standardise formats and time zones, remove exact duplicates, apply business rules.
- Build gold models (facts and dimensions) with tests.
- Publish and notify consumers; update the catalog and freshness monitor.
- Schedule in the orchestrator with retries, timeouts and alerts. Deploy through CI/CD.
- Row counts reconcile with the source within the agreed tolerance.
- Rerunning the same date produces identical results (idempotent).
- Restore the previous version of the gold tables (table versioning or a snapshot), or rerun for the failing date after the fix.
A safe, repeatable load uses an upsert so reruns do not create duplicates:
MERGE INTO silver.orders AS t
USING (
SELECT * FROM bronze.orders_batch
WHERE load_date = DATE '2026-11-14'
) AS s
ON t.order_id = s.order_id
WHEN MATCHED AND s.updated_at > t.updated_at THEN UPDATE SET
status = s.status, amount = s.amount, updated_at = s.updated_at
WHEN NOT MATCHED THEN INSERT (order_id, customer_id, status, amount, updated_at)
VALUES (s.order_id, s.customer_id, s.status, s.amount, s.updated_at);
And a common clean-up pattern keeps only the latest record per key:
SELECT *
FROM (
SELECT *, ROW_NUMBER() OVER (PARTITION BY order_id ORDER BY updated_at DESC) AS rn
FROM bronze.orders
) x
WHERE rn = 1;
Set up change data capture (CDC) from a database
- Use when
- You need near-real-time copies of operational tables.
- A replica or log access on the source and agreement from the database owner.
- A target store and a place to keep offsets.
- Enable the database change log (for example logical replication or binary logs) and create a read-only replication user.
- Take an initial full snapshot of the tables.
- Start the CDC reader (a managed service or a connector) from the snapshot position.
- Land change events (insert, update, delete, with timestamps and sequence numbers) in bronze.
- Apply changes to silver in order, handling deletes (soft-delete flag or removal).
- Monitor lag (seconds behind the source) and set an alert threshold.
- Counts and checksums of sample tables match the source after catching up.
- A test row inserted, updated and deleted at the source appears correctly downstream.
- Stop the connector, keep the offset, fix the issue and resume. If the log was lost, take a new snapshot and restart.
Backfill or reprocess historical data safely
- Use when
- Logic changed, a bug was fixed, or data was missing for a period.
- The raw data for the period still exists.
- Agreement from downstream owners on timing.
- Define the exact date range and the tables affected.
- Copy or snapshot the current outputs for the range so you can compare or revert.
- Run the pipeline for the range in small chunks (for example one day or one week at a time), in the same code path as normal runs, with a lower priority so normal loads are not delayed.
- Use overwrite-by-partition or MERGE so reruns replace rather than duplicate.
- After each chunk run the quality checks and compare totals with the snapshot (explain differences).
- Tell consumers when the corrected data is ready; refresh dependent dashboards and models.
- Totals by day match expectations; no duplicate keys; downstream reports reconcile.
- Restore the snapshot for the range and stop the backfill.
Roll out a schema change using expand and contract
- Use when
- A source or model column must change without breaking readers.
- Impact analysis from lineage; consumers informed.
- Expand: add the new column or table; keep the old one. Populate both.
- Update consumers one by one to the new structure; track who has moved.
- Contract: after the deprecation period and consumer confirmation, stop populating the old column and remove it in a later release.
- No failed downstream jobs; consumer queries return the same results.
- Keep or restore the old column; it is retained until the end.
Model a business process as a star schema
- Use when
- Reporting on something like sales, orders or tickets.
- A clear business question and an agreed definition of the measure.
- Choose the business process (for example order line).
- Declare the grain: one row per what? (for example per order line per day). Write it down.
- Pick the dimensions (customer, product, date, store) and give each a surrogate key.
- Pick the facts: numeric measures such as quantity and amount, additive where possible.
- Decide how dimensions change over time. Type 1 overwrites; Type 2 keeps history with start and end dates and a current flag.
- Build and test: unique keys, no orphan foreign keys, totals reconcile with the source system.
- Document definitions and publish through the catalog or semantic layer.
- Totals equal the finance or source-of-truth numbers.
- Keep the previous model version until users move; revert the view that points to it.
Add a streaming pipeline (when you truly need it)
- Use when
- Dashboards, alerts or applications that need data within seconds.
- A clear latency target and a business reason; a message platform (Kafka, Kinesis, Pub/Sub, Event Hubs).
- Define the event schema and register it in a schema registry; agree on keys and ordering.
- Producers publish events; use a key (such as customer id) so related events stay in order.
- Consumers read in consumer groups, process with a streaming engine, and write results to a store.
- Make processing idempotent: events can be delivered more than once. Deduplicate by event id.
- Handle late and out-of-order events with event-time windows and a defined lateness limit.
- Send events that fail processing to a dead-letter queue and alert; reprocess after the fix.
- Monitor consumer lag, throughput and error rate.
- End-to-end latency meets the target; replaying a sample produces the same results.
- Pause consumers, fix, and replay from the saved offset.
Restore a dataset to an earlier point
- Use when
- Bad data was published, or a table was changed or deleted by mistake.
- Table versioning ("time travel") or snapshots exist and are within retention.
- Stop the pipelines that write to the table.
- Find the last good version or time.
- Restore into a new table or clone and compare with the current one.
- Swap the restored table into place in a planned step, or point the view to it.
- Restart pipelines, rerun missed loads, and tell consumers.
- Row counts and spot checks match what was expected at that point in time.
- Swap back to the previous table.
5. Data quality tests you can copy
Simple SQL checks catch most issues. Each should return zero rows when everything is healthy.
-- 1. Uniqueness of the key
SELECT order_id, COUNT(*) FROM silver.orders GROUP BY order_id HAVING COUNT(*) > 1;
-- 2. No missing required values
SELECT * FROM silver.orders WHERE order_id IS NULL OR customer_id IS NULL;
-- 3. Referential integrity (no orders pointing to a missing customer)
SELECT o.order_id FROM silver.orders o
LEFT JOIN silver.customers c ON c.customer_id = o.customer_id
WHERE c.customer_id IS NULL;
-- 4. Freshness (data should be less than 26 hours old for a daily load)
SELECT 1 WHERE (SELECT MAX(loaded_at) FROM silver.orders) < CURRENT_TIMESTAMP - INTERVAL '26 hours';
-- 5. Volume (today is within 30% of the 7-day average)
-- compare today's row count with the average of the previous seven days
6. Common mistakes to avoid
- Transforming data on the way in and keeping no raw copy, so mistakes cannot be corrected.
- Pipelines that cannot be rerun safely.
- Building streaming for problems that a daily load solves.
- No ownership: nobody can answer "is this number right?".
- Changing a column name upstream without telling anyone.
- Putting personal data into every layer, including test and analytics copies.
- Skipping tests because "the dashboard looked fine".
- Using one giant table with unclear grain and definitions.
- Letting small files and unpartitioned tables multiply until queries and bills explode.
- Having secrets or passwords written inside pipeline code.
7. Measure what matters
| Metric | What it shows | Typical target |
|---|---|---|
| Freshness / SLA met | Data arrives when promised | 95%+ of runs on time |
| Pipeline success rate | Reliability | Above 98% without manual fix |
| Data quality check pass rate | Trust | Rising, with critical checks at 100% |
| Mean time to detect and fix data issues | Responsiveness | Detect in minutes, fix in hours |
| Dataset coverage in catalog with owner | Governance | Close to 100% for critical data |
| Cost per TB processed or per report | Efficiency | Flat or falling |
| Consumer satisfaction | Real value | Survey twice a year |
8. A 30-60-90 day starting plan
- Days 1โ30: list your sources, owners and most important reports; pick one high-value use case; stand up the landing, bronze, silver and gold structure; set Git and CI/CD for pipeline code.
- Days 31โ60: build the first pipeline end to end with tests (MOP-1), add freshness and volume monitoring, create the catalog and name owners.
- Days 61โ90: add data contracts for your top sources, a quality scorecard, access and retention rules for personal data, and a cost review. Then repeat for the next use case.
9. Quick checklists
Before a pipeline goes live
- Source owner and data contract agreed.
- Raw data is kept; transformations are tested and idempotent.
- Quality checks, alerts and a runbook exist.
- Sensitive data is classified, masked and access-controlled.
- Catalog entry with owner and description is published.
- Cost estimate and budget alert are set.
When data looks wrong
- Check freshness and the last successful run.
- Compare row counts with the source.
- Look for upstream schema or definition changes.
- Check recent code or configuration changes.
- Quarantine, fix, backfill (MOP-3) and tell consumers.
Need a hand? We design and build data platforms, pipelines and AI-ready data foundations. See Data Engineering or get in touch. For deploying pipelines safely, read our Cloud & DevOps guide.