Data quality, governance, security and the DPDP Act

A pipeline can run perfectly and still publish wrong numbers, and a single shared sheet can leak lakhs of phone numbers. In this lesson you learn the six data quality dimensions, build a quality gate that quarantines bad rows, trace a 100× revenue error with lineage, see one table masked differently for each role, and handle an erasure request and a breach under India’s DPDP Act.

Module 5 · Governance and Security⏱ 30 minBeginner → AdvancedRuns in your browser (Python)3 real-time scenariosQuality gate for your PC9 practice problems
1 The story

Every job was green

On Monday morning TiffinGo’s revenue dashboard shows ₹38.6 crore for Sunday, a hundred times the usual figure. The CEO forwards it to the whole leadership group with one line: “Is this real?” By noon Kabir finds the cause: the payments team started sending amounts in paise instead of rupees, and nothing in the pipeline checked. On Wednesday a vendor reports that a spreadsheet with two lakh customer phone numbers is open to anyone with the link.

Monday 9:30 am · revenue dashboardYesterday: ₹38.6 crore(usual: ₹38.6 lakh)CEO forwards it: “Is this real?”+Same week, a second problem• a shared sheet has 2 lakh customer phone numbers, open to “anyone with the link”• found by a vendor, not by us Wrong data and leaked data are both big data failures. myphatshala.in
Kabir

Sir, the pipeline didn’t fail. Every job was green. That’s what scares me.

Arjun Sir

That’s the lesson, Kabir. A pipeline can run perfectly and still deliver wrong data. Data quality checks catch that. And knowing who owns each table, where it came from and who may see it is governance.

Riya

And the phone numbers? That sounds like a security problem, not a data one.

Arjun Sir

It’s both, Riya. Personal data needs protection by design: masking, access control, encryption, audit logs. In India the Digital Personal Data Protection Act, 2023 also makes it a legal duty, with penalties of up to ₹250 crore.

Kabir

So quality, governance, security and privacy are four separate jobs?

Arjun Sir

Four sides of one promise: the right data, correct, to the right people, used lawfully. Today you’ll build a quality gate, trace a broken number to its source, mask personal data, and handle a deletion request and a breach the DPDP way.

2 Definition

Data quality, governance, security and privacy

Formal definition (write this in exams)

Data quality is the degree to which data is fit for its intended use, measured along dimensions such as accuracy, completeness, consistency, timeliness, validity and uniqueness. Data governance is the set of roles, policies, standards and processes that ensure data is managed as an asset: ownership and stewardship, metadata and catalogs, lineage, classification, retention and access policies. Data security protects data against unauthorised access, modification and loss through identity and access management, encryption, network controls, monitoring and auditing. Data privacy governs the lawful processing of personal data, in India under the Digital Personal Data Protection Act, 2023 and the DPDP Rules, 2025.

In simple words

Quality: is the data correct? Governance: who owns it, what does it mean, who may use it? Security: is it locked so only the right people can reach it? Privacy: are we using people’s personal data fairly, with their permission, and as the law requires?

Words you’ll meet in this lesson

PIIPersonally identifiable information: data that identifies a person, such as name, phone, email, Aadhaar or address.
Data owner / stewardThe owner is accountable for a dataset; the steward manages its definitions and quality day to day.
Data catalogA searchable inventory of datasets with owners, descriptions, schemas, tags and usage.
LineageThe path data takes from sources through transformations to reports and models.
QuarantineHolding bad rows aside for review instead of loading them into trusted tables.
MaskingHiding part or all of a value (XXXXXX8843) for users who don’t need the full value.
PseudonymisationReplacing identifiers with tokens or salted hashes so data can be joined without exposing identity.
Data fiduciary / principalUnder DPDP: the organisation deciding how personal data is processed / the person the data is about.

DPDP Act and Rules: the key facts (as of October 2026)

Law and rulesDigital Personal Data Protection Act, 2023; DPDP Rules, 2025 notified in November 2025, with phased implementation
TimelineData Protection Board set up first; consent-manager provisions from about November 2026; most obligations from about May 2027 (the government has consulted on shortening this for large companies)
BreachInform the Data Protection Board and affected people without delay; a detailed report to the Board within 72 hours
PenaltiesUp to ₹250 crore for failing to take reasonable security safeguards; up to ₹200 crore for not notifying a breach or for children’s-data violations

This is a learning summary, not legal advice. Check the current Act, Rules and notifications on meity.gov.in before making compliance decisions.

Quality, governance and security at three levels

Pick your level. New to this? Start at Beginner and climb.

Beginner Trustworthy data, simply

  • Data quality means the data is correct and usable: no missing values where needed, no duplicates, sensible ranges, delivered on time.
  • Governance means clear rules: who owns each dataset, what each column means, who may use it, how long it is kept.
  • Security means only allowed people and programs can read or change data, and every access is logged.
  • Privacy means personal data (name, phone, email, location, payments) is collected with consent, used only for the stated purpose and deleted when no longer needed.

Intermediate How teams put it into practice

  • Quality dimensions: accuracy, completeness, consistency, timeliness (freshness), validity (format and range) and uniqueness.
  • Quality checks in pipelines: tests on every load (row counts, nulls, ranges, uniqueness, referential integrity), with bad rows quarantined and the pipeline stopped above a threshold. Tools: Great Expectations, dbt tests, Soda, Deequ, Delta Live Tables expectations.
  • Governance tools: a data catalog (what exists, owner, meaning), lineage (where data came from and where it goes), classification (tagging PII and sensitive columns) and data contracts between producers and consumers.
  • Security controls: role-based access (RBAC), column masking and row-level filters, encryption at rest and in transit, secrets in a vault, private networks, audit logs.

Advanced Privacy law, observability and hard problems

  • DPDP Act, 2023 (India): data principals (people) and data fiduciaries (companies); consent that is free, specific and informed, with notice; purpose limitation; rights to access, correction and erasure; reasonable security safeguards; breach notification to the Data Protection Board and affected people; extra duties for children’s data and for Significant Data Fiduciaries.
  • Erasure at big data scale: deleting one person from a lake means deleting from tables, derived tables, caches, ML features and eventually backups. Table formats (Delta, Iceberg, Hudi) support row-level deletes; pseudonymous keys and separate PII stores make it manageable.
  • Pseudonymisation vs anonymisation: replacing an email with a salted hash is pseudonymisation (still personal data if it can be linked back); true anonymisation is hard because combinations of columns can re-identify people.
  • Data observability: monitoring freshness, volume, schema and distribution changes automatically, with alerts, rather than relying only on hand-written tests.
  • Data mesh and contracts: domain teams own their data products, publish schemas and SLAs as contracts, and breaking changes are caught before deployment.

Exam tip: List the six data quality dimensions with an example each, define data governance and its components (ownership, catalog, lineage, classification, policies), and name the main rights of a data principal and duties of a data fiduciary under the DPDP Act, 2023.

3 Types and ways to use it

Six quality dimensions and four pillars

DimensionQuestion it answersExample check at TiffinGo
AccuracyDoes the value match reality?Order amounts agree with payment-gateway settlement totals
CompletenessIs anything missing?City is never empty; yesterday has orders from every city
ConsistencyDo systems agree with each other?Order count in the lake equals the count in the orders database
TimelinessIs it fresh enough?Yesterday’s gold table is ready by 6:00 am
ValidityIs it in the right format and range?Phone is 10 digits starting 6–9; amount between ₹1 and ₹50,000
UniquenessAre there duplicates?Each order_id appears exactly once

Four pillars of trustworthy data

Quality

Tests and monitors on every pipeline: row counts, nulls, ranges, uniqueness, freshness, reconciliation with source systems.

Correct

Governance

Owners and stewards, a catalog with business definitions, lineage, classification tags, retention rules and data contracts.

Understood

Security

Least-privilege access, masking and row filters, encryption, secrets management, private networks, audit logs.

Protected

Privacy

Consent and notice, purpose limitation, minimisation, rights requests (access, correction, erasure), breach handling under DPDP.

Lawful

A cheap rule that saves careers: never publish a table you haven’t tested, and never copy personal data to a place that is less protected than its source (a laptop, a shared sheet, a test environment).

4 Step by step

Making a dataset trustworthy

  1. Classify the data

    Kabir tags every column in the catalog: phone, email, address as PII; amount as financial; city as internal.

    You can’t protect what you haven’t labelled. Tags drive masking, access policies and retention automatically.
  2. Write quality rules with the owner

    rows = [120, 450, -150, 300, 0, 99000]
    bad = [r for r in rows if not 1 <= r <= 50_000]
    print("bad:", bad, f"-> {len(bad) / len(rows):.0%} failed")
    bad: [-150, 0, 99000] -> 50% failed
    Rules come from business meaning, so the data owner signs off: “amount between ₹1 and ₹50,000”, “one row per order”, “ready by 6 am”.
  3. Gate the pipeline

    Checks run after every load. Bad rows go to a quarantine table; if more than 2% fail, the pipeline stops and alerts the owner instead of publishing.

    A stopped pipeline with an alert is far better than a confident wrong dashboard.
  4. Mask and restrict

    phone = "9876543210"
    print("masked:", "XXXXXX" + phone[-4:])
    masked: XXXXXX3210
    Analysts get masked phones and pseudonymous customer keys; only the support tool can see full numbers, and every lookup is logged.
  5. Record lineage and ownership

    Each table in the catalog shows its owner, description, upstream sources and downstream dashboards, captured automatically from pipeline code where possible.

    When a number looks wrong, lineage turns hours of guessing into minutes of tracing.
  6. Plan for rights and breaches

    A runbook says how to find and delete one customer everywhere, how long each table is kept, and who notifies the Data Protection Board and customers if a breach happens.

    DPDP turns these from good ideas into legal duties with deadlines.
5 See it happen

A wrong number: what Kabir sees, and where it came from

Step through the six frames. Left: the dashboard Kabir is debugging. Right: the lineage graph that leads him to the cause.

What Kabir sees, and how the data moved 6 steps
What you see Revenue · Sunday₹38.6 croreusual Sunday: about ₹38.6 lakhRevenue · Sunday₹38.6 croreKabir opens the table’s lineageRevenue · Sunday₹38.6 croreupstream: payments.ordersRevenue · Sunday₹38.6 croreschema change found: amount in paiseRevenue · Sunday₹38.6 lakhfixed and backfilledRevenue · Sunday₹38.6 lakha new check now guards this table myphatshala.in
Behind the screen paymentsordersbronzeorderssilverordersgoldrevenuegold.revenue is 100× too high. All jobs were green.No check looked at the values.paymentsordersbronzeorderssilverordersgoldrevenueLineage in the catalog shows upstream tables.silver.orders sums match gold: not the bug.paymentsordersbronzeorderssilverordersgoldrevenuebronze is a raw copy of payments.orders.Median amount jumped from 320 to 32,000.paymentsordersbronzeorderssilverordersgoldrevenuePayments team changed amount to paise on Saturday.No data contract, so no one was told.paymentsordersbronzeorderssilverordersgoldrevenuesilver now divides by 100 for new rows;Saturday–Sunday partitions are reprocessed.paymentsordersbronzeorderssilverordersgoldrevenueNew: contract on amount unit + range check(median between ₹100 and ₹2,000) before publish. myphatshala.in
6 Real-world use

Real-time scenarios: quality gate, access and privacy law

Three live scenarios: a quality gate on a real batch (numbers from the program below), one table seen through different roles, and an advanced look at erasure requests and breaches under the DPDP Act.

Real-time scenario 1

A quality gate catches 110 bad rows

These figures come from the program in “Run it on your PC” below. Watch a nightly batch pass through four checks before it is allowed into trusted tables.

Quality gate 5 steps
Animated example Batch of 10,030 order rowsrunning checks…A nightly batch arrives: 10,030 rows of orders.Four checks run before anything is published.Batch of 10,030 order rowsamount is positive40order_id unique3040 negative amounts and 30 duplicate order IDs(the same order sent twice by a retry).Batch of 10,030 order rowsamount is positive40order_id unique30city present25phone 10 digits1525 missing cities, 15 invalid phone numbers.Each failing row goes to a quarantine table.Batch of 10,030 order rowsamount is positive40order_id unique30city present25phone 10 digits159,920 rows pass, 110 quarantined:failure rate 1.10%, below the 2% threshold.Batch of 10,030 order rowsamount is positive40order_id unique30city present25phone 10 digits15Decision: PUBLISH the good rows, alert the ownerabout the 110 quarantined rows to review. myphatshala.in
Real-time scenario 2

One table, different views for different roles

Instead of making copies with columns removed, modern platforms apply masking and row filters when the query runs, based on who is asking. Watch the same query return different results.

Access control and masking 5 steps
Animated example SELECT * FROM customers — as support agentnamephonecityordersAsha P9876543210Pune14Ravi K9123456780Thane3Support needs the full phone to call about alate order. Every lookup is written to an audit log.SELECT * FROM customers — as analystnamephonecityorders█████XXXXXX3210Pune14█████XXXXXX6780Thane3Analysts see the same table with names hiddenand phones masked: enough for city trends.SELECT * FROM customers — as analyst (Pune)namephonecityorders█████XXXXXX3210Pune14A row-level filter also limits the Pune city teamto Pune customers only.EXPORT customers TO shared_sheet — as internExport of PII to a laptop or shared sheet isblocked by policy. Wednesday’s leak can’t repeat.✗ Denied: table has PII-tagged columnsRequest access with a reason, or export a masked view.SELECT * FROM audit_log — as security teamusertablerowstimesupport_17customers4211:02analyst_3customers3,91002:14Audit logs show who read which PII and when,so unusual access can be spotted and investigated. myphatshala.in
Real-time scenario 3 · advanced

An erasure request and a breach under the DPDP Act

Privacy law turns data engineering choices into deadlines. Watch how a well-governed lake handles a customer’s erasure request, and what must happen when a breach is found.

DPDP in a data platform 5 steps
Animated example Erasure request: customer key 97c8…orders (lake)has datafeatures (ML)has dataCRM exporthas databackupshas dataAsha withdraws consent and asks TiffinGo toerase her data. Where does it live?Erasure request: customer key 97c8…orders (lake)deletedfeatures (ML)has dataCRM exporthas databackupshas dataLake table: row-level DELETE by customer key(Delta/Iceberg), then old file versions vacuumed.Erasure request: customer key 97c8…orders (lake)deletedfeatures (ML)deletedCRM exportdeletedbackupsexpires 35 dFeatures and the CRM export are cleaned; backupsexpire on schedule and are not restored for her.Breach: 2 lakh phone numbers exposedorders (lake)has datafeatures (ML)has dataCRM exportexposedbackupshas dataLater: a misconfigured CRM export is foundpublicly readable. A personal data breach.Breach: 2 lakh phone numbers exposedorders (lake)has datafeatures (ML)has dataCRM exportaccess closedbackupshas dataClose access, investigate, inform the Board andaffected people; detailed report within 72 hours. myphatshala.in

Where you’ll see this at work

1. Quality checks in every pipeline

Data teams add tests (dbt tests, Great Expectations, Soda, Deequ) to each model and stop publishing on failure. Data observability tools watch freshness, volume and schema automatically.

Load→Tests + thresholds→Publish or stop

2. Catalogs and lineage

Unity Catalog, AWS Glue Data Catalog with Lake Formation, Microsoft Purview, Google Dataplex, DataHub and OpenMetadata record owners, descriptions, PII tags and lineage.

Pipelines→Catalog + lineage→Find, trust, debug

3. Banks, fintech and health

Regulated sectors combine RBI, SEBI or sector rules with DPDP: tokenised card data, data localisation, strict access reviews and long audit trails.

Sensitive data→Encrypt, mask, audit→Regulator-ready
DPDP

4. Consumer apps preparing for DPDP

Indian apps are building consent records, purpose tags, deletion workflows across lakes and backups, and breach-response runbooks before the main obligations apply.

Consent + notice→Purpose + retention→Erasure + breach plan

Sources

7 Run the code

Write your first data quality checks

A few order rows are checked against rules for validity, completeness and uniqueness. Rows that fail are quarantined with the reason. Then try the challenges: freshness, reconciliation, masking, pseudonymous keys and a publish threshold.

orders = [
    {"id": "O1", "city": "Pune",   "amount": 320},
    {"id": "O2", "city": "",       "amount": 150},
    {"id": "O3", "city": "Thane",  "amount": -40},
    {"id": "O1", "city": "Pune",   "amount": 320},
    {"id": "O4", "city": "Mumbai", "amount": 610},
]
seen, good, quarantine = set(), [], []
for o in orders:
    reasons = []
    if not o["city"]:
        reasons.append("missing city")
    if o["amount"] <= 0:
        reasons.append("amount not positive")
    if o["id"] in seen:
        reasons.append("duplicate id")
    seen.add(o["id"])
    (quarantine if reasons else good).append((o["id"], reasons))

print("good      :", [i for i, _ in good])
print("quarantine:", quarantine)
good : ['O1', 'O4'] quarantine: [('O2', ['missing city']), ('O3', ['amount not positive']), ('O1', ['duplicate id'])]
  • if not o["city"]:Completeness: a required field is empty.
  • if o["id"] in seen:Uniqueness: the same order arrived twice.

Run it on your PC: a quality gate with privacy masking

This program creates a batch of 10,030 orders with realistic problems (negative amounts, missing cities, invalid phones, duplicates), runs four quality checks, quarantines failing rows, decides whether to publish, and writes a clean CSV where emails become pseudonymous keys and phones are masked. Save it as quality_guard.py.

Check, quarantine, mask, publish

"""A small data-quality gate and privacy step for a batch of orders.
1) generate a realistic messy batch, 2) run quality checks,
3) quarantine bad rows, 4) mask personal data before it reaches analysts."""
import csv, hashlib, random, re
from collections import Counter

random.seed(11)
CITIES = ["Pune", "Mumbai", "Thane", "Nashik"]
rows = []
for i in range(1, 10_001):
    rows.append({"order_id": f"O{i:05d}", "phone": f"9{random.randint(100000000, 999999999)}",
                 "email": f"user{i}@example.com", "city": random.choice(CITIES),
                 "amount": str(random.randint(80, 900)), "order_date": "2026-10-19"})
# inject the kinds of problems real batches have
for i in random.sample(range(10_000), 40):
    rows[i]["amount"] = "-150"                    # negative amount
for i in random.sample(range(10_000), 25):
    rows[i]["city"] = ""                          # missing city
for i in random.sample(range(10_000), 15):
    rows[i]["phone"] = "12345"                    # invalid phone
rows += [dict(rows[i]) for i in random.sample(range(10_000), 30)]   # duplicates

CHECKS = {
    "amount is positive": lambda r: r["amount"].lstrip("-").isdigit() and int(r["amount"]) > 0,
    "city present": lambda r: r["city"] in CITIES,
    "phone is 10 digits": lambda r: re.fullmatch(r"[6-9]\d{9}", r["phone"]) is not None,
}
seen, good, bad, failures = set(), [], [], Counter()
for r in rows:
    problems = [name for name, ok in CHECKS.items() if not ok(r)]
    if r["order_id"] in seen:
        problems.append("order_id unique")
    seen.add(r["order_id"])
    for p in problems:
        failures[p] += 1
    (bad if problems else good).append(r)

print(f"batch rows      : {len(rows):,}")
for name, n in failures.most_common():
    print(f"  FAIL {name:20}: {n}")
print(f"passed          : {len(good):,}  quarantined: {len(bad)}")
fail_rate = len(bad) / len(rows) * 100
print(f"failure rate    : {fail_rate:.2f}%  ->", "PUBLISH" if fail_rate < 2 else "STOP the pipeline")

SALT = "keep-this-secret"       # in real life: from a secrets manager, never in code
def pseudonym(value):
    return hashlib.sha256((SALT + value).encode()).hexdigest()[:12]
def mask_phone(p):
    return "XXXXXX" + p[-4:]

with open("orders_clean.csv", "w", newline="") as f:
    w = csv.DictWriter(f, fieldnames=["order_id", "customer_key", "phone_masked", "city", "amount", "order_date"])
    w.writeheader()
    for r in good:
        w.writerow({"order_id": r["order_id"], "customer_key": pseudonym(r["email"]), "phone_masked": mask_phone(r["phone"]),
                    "city": r["city"], "amount": r["amount"], "order_date": r["order_date"]})
print("\nwrote orders_clean.csv (no raw email or phone). First row:")
print(open("orders_clean.csv").read().splitlines()[1])

# In a terminal:  python quality_guard.py
batch rows : 10,030 FAIL amount is positive : 40 FAIL order_id unique : 30 FAIL city present : 25 FAIL phone is 10 digits : 15 passed : 9,920 quarantined: 110 failure rate : 1.10% -> PUBLISH wrote orders_clean.csv (no raw email or phone). First row: O00001,97c803c4828b,XXXXXX8843,Nashik,542,2026-10-19

Recorded from a real run with Python 3.13 (only the standard library). The data is generated with a fixed random seed, so you will get the same counts. In production the salt would come from a secrets manager, and tools such as Great Expectations, dbt tests or Soda would run the checks.

8 Line by line

A quality check, one row at a time

Four amounts are checked against a valid range. Watch the pass and fail lists fill up.

Worked examples: real problems, solved and traced in memory

Four data-quality and privacy tasks from a real platform. Each runs live and is traced.

Example 1BeginnerQuality · completeness

Percentage of missing values per column

Problem statement

Count how many values are missing in each column of a small customer table, as a percentage.

Input
4 rows with name, city, phone
Expected output
name : 25% missing
city : 50% missing
phone: 25% missing

Approach

  1. For each column, count values that are empty or None.
  2. Divide by the number of rows.
  3. Print as a percentage.

Solution: run it live

What happens in memory, step by step

Recorded from a real Python run: press Next to execute one line at a time. Watch variables change in each frame, and lists and dictionaries (numbered #1, #2 …) fill up as objects.

Example 2IntermediateQuality · distribution

Catch the rupees-to-paise bug

Problem statement

Compare today’s median order amount with the last 7 days. Flag it if it is more than 3 times higher or lower than the 7-day median.

Input
7 daily medians and today’s median
Expected output
baseline 322, today 32150, ratio 100x -> ALERT

Approach

  1. Compute the median of the last 7 daily medians.
  2. Ratio = today ÷ baseline.
  3. Flag if ratio > 3 or < 1/3.

Solution: run it live

What happens in memory, step by step

Recorded from a real Python run: press Next to execute one line at a time. Watch variables change in each frame, and lists and dictionaries (numbered #1, #2 …) fill up as objects.

Example 3IntermediateGovernance · catalog

Find every column tagged as PII

Problem statement

A small catalog maps tables to columns and tags. List every PII column, grouped by table, so the privacy team knows where personal data lives.

Input
catalog dictionary
Expected output
customers: ['name', 'phone']
support_tickets: ['email', 'message']

Approach

  1. Loop over tables and their columns.
  2. Keep columns whose tags include “pii”.
  3. Print table: columns.

Solution: run it live

What happens in memory, step by step

Recorded from a real Python run: press Next to execute one line at a time. Watch variables change in each frame, and lists and dictionaries (numbered #1, #2 …) fill up as objects.

Example 4AdvancedPrivacy · erasure

Erase one customer across tables

Problem statement

A customer’s pseudonymous key must be removed from three tables. Delete matching rows, count deletions per table and record an audit entry.

Input
tables keyed by customer_key, key "97c8"
Expected output
deleted: {'orders': 2, 'features': 1, 'crm_export': 0} | remaining orders: [('a1b2', 150)]

Approach

  1. For each table, keep rows whose key is different.
  2. Count how many were removed.
  3. Append an audit record with the counts.

Solution: run it live

What happens in memory, step by step

Recorded from a real Python run: press Next to execute one line at a time. Watch variables change in each frame, and lists and dictionaries (numbered #1, #2 …) fill up as objects.

9 Quiz and revision

Check yourself

Quick revision

Lesson 5.1 in one screen

  • Six quality dimensions: accuracy, completeness, consistency, timeliness, validity, uniqueness.
  • Gate pipelines: test every load, quarantine bad rows, stop above a threshold, alert the owner.
  • Green jobs ≠ correct data: add range, distribution and reconciliation checks.
  • Governance = owners/stewards, catalog, lineage, classification (PII tags), contracts, retention.
  • Security = least privilege (RBAC), masking, row filters, encryption, secrets vault, audit logs.
  • Pseudonymisation (salted hash) ≠ anonymisation; deletion in lakes via Delta/Iceberg/Hudi deletes + vacuum.
  • DPDP 2023 + Rules 2025: consent, purpose limits, erasure, safeguards, breach report within 72 h, penalties up to ₹250 crore.

Interview and viva questions

What are the dimensions of data quality?

The commonly used dimensions are accuracy (values match reality), completeness (no missing required data), consistency (systems and tables agree), timeliness (data is fresh when needed), validity (values follow formats, types and ranges) and uniqueness (no unintended duplicates). Some frameworks add integrity, relevance and accessibility.

What is the difference between data governance and data management?

Data governance sets the rules, roles and accountability: who owns data, what policies apply, how quality and access are decided. Data management is the day-to-day execution: building pipelines, storing, securing, cleaning and delivering data according to those rules.

How do you implement data quality checks in a pipeline?

Define rules with data owners, then run automated tests after each load: schema, row counts, nulls, ranges, uniqueness, referential integrity, freshness and reconciliation with source totals. Quarantine failing rows, stop publishing above a threshold, alert the owner and track quality metrics over time. Tools include dbt tests, Great Expectations, Soda, Deequ and Delta Live Tables expectations.

What is the DPDP Act and how does it affect data engineers?

The Digital Personal Data Protection Act, 2023 is India's law on processing digital personal data, made operational by the DPDP Rules, 2025 with phased timelines. It requires notice and consent, purpose limitation, data minimisation, reasonable security safeguards, honouring rights such as erasure, breach notification and extra care for children's data. For data engineers this means tagging PII, limiting copies, masking, access controls, retention and deletion workflows across lakes and backups, audit logs and breach-response plans.

How do you delete personal data from a data lake?

Locate all copies using a catalog and a consistent customer key, run row-level deletes on tables stored in formats such as Delta Lake, Apache Iceberg or Hudi, remove old file versions with vacuum or snapshot expiry, delete derived tables, features and exports, and let immutable backups expire on a defined schedule without restoring erased records. Record the request and completion for audit.

Practice problems

Data-quality, masking and privacy exercises. The last two are business tasks.

P1Easy

Count nulls

Count the None values in [12, None, 7, None, 3].

Input
list
Expected output
2
Show solution and explanation
print([12, None, 7, None, 3].count(None))
2

How it works: Completeness checks start with counting missing values.

P2Easy

Find duplicates

Print the IDs that appear more than once in ["a", "b", "a", "c", "b", "a"].

Input
list of IDs
Expected output
['a', 'b']
Show solution and explanation
from collections import Counter
print([k for k, v in Counter(["a", "b", "a", "c", "b", "a"]).items() if v > 1])
['a', 'b']

How it works: Uniqueness check: count occurrences per key.

P3Easy

Mask a phone

Print 9876543210 with only the last 4 digits visible.

Input
9876543210
Expected output
XXXXXX3210
Show solution and explanation
p = "9876543210"
print("X" * 6 + p[-4:])
XXXXXX3210

How it works: Masking keeps enough to recognise a number without exposing it.

P4Medium

Validate phones

Print which of ["9876543210", "12345", "6123456789", "5123456789"] are valid Indian mobile numbers (10 digits, starting 6–9).

Input
4 strings
Expected output
['9876543210', '6123456789']
Show solution and explanation
import re
print([p for p in ["9876543210", "12345", "6123456789", "5123456789"] if re.fullmatch(r"[6-9]\d{9}", p)])
['9876543210', '6123456789']

How it works: A regular expression expresses the validity rule precisely.

P5Medium

Reconcile totals

Source total Rs 15,43,289; lake total Rs 15,43,164. Print the difference and whether it is within Rs 100.

Input
two totals
Expected output
-125 MISMATCH
Show solution and explanation
d = 15_43_164 - 15_43_289
print(d, "OK" if abs(d) <= 100 else "MISMATCH")
-125 MISMATCH

How it works: Consistency checks compare systems; tolerances must be agreed with the owner.

P6Advanced

Pseudonymous key

Print the first 10 hex characters of SHA-256 of "salt" + "asha@example.com".

Input
email
Expected output
d17065027e
Show solution and explanation
import hashlib
print(hashlib.sha256(("salt" + "asha@example.com").encode()).hexdigest()[:10])
d17065027e

How it works: The same input always gives the same key, so joins still work.

P7Advanced

Retention check

Partitions older than 365 days must be deleted. Given ages [12, 400, 365, 800, 90], print those to delete.

Input
ages in days
Expected output
[400, 800]
Show solution and explanation
print([a for a in [12, 400, 365, 800, 90] if a > 365])
[400, 800]

How it works: Retention rules limit how long personal data is kept.

P8Business problem

Cost of bad data

Each wrongly refunded order costs Rs 240. Duplicates caused 1,850 wrong refunds last month. Print the loss and the yearly loss.

Input
1,850 × Rs 240
Expected output
Rs 444,000 per month, Rs 5,328,000 per year
Show solution and explanation
m = 1_850 * 240
print(f"Rs {m:,} per month, Rs {m * 12:,} per year")
Rs 444,000 per month, Rs 5,328,000 per year

How it works: Putting a rupee value on quality issues helps prioritise fixes.

P9Business problem

Quality score

A table passed 46 of 50 checks this week. Print the quality score and whether it meets the 95% target.

Input
46/50
Expected output
92% below target
Show solution and explanation
s = 46 / 50
print(f"{s:.0%}", "meets target" if s >= 0.95 else "below target")
92% below target

How it works: A simple score per table makes quality visible to owners.

Real-world scenario questions (asked in company interviews)

Quality, security and privacy questions from real projects and interviews. Decide your answer first, then open the model answer.

Data qualityFresher

The dashboard shows 100× revenue

A revenue dashboard suddenly shows a figure about 100 times higher than usual. All pipeline jobs succeeded.

The interviewer is checking: can you debug a data issue systematically?

Show a strong answer
  1. Confirm the symptom and its start date; tell stakeholders you are investigating.
  2. Follow lineage upstream, comparing counts and sums at each layer to find where values change.
  3. Check for schema or unit changes (rupees to paise), duplicates, or join explosions.
  4. Fix the transformation and backfill affected partitions.
  5. Prevent recurrence: range/distribution checks, a data contract with the source team, and alerts.

Avoid: patching the dashboard number by hand.

Security1–3 years

Analysts need customer data, safely

Analysts want access to the customers table, which includes names, phones and addresses.

The interviewer is checking: do you apply least privilege without blocking useful work?

Show a strong answer
  • Classify columns and tag PII in the catalog.
  • Give analysts a view or policy with names removed, phones masked and a pseudonymous customer key for joins.
  • Use row-level filters where teams should see only their region.
  • Keep full access for the few roles that need it, with audit logs and periodic access reviews.
  • Block exports of PII to unmanaged locations.

Avoid: giving everyone full access “just for now”, or refusing access entirely.

Privacy · DPDP1–3 years

Delete one customer from the lake

A customer withdraws consent and asks for erasure. Their data is in raw files, Delta tables, ML features and nightly backups.

The interviewer is checking: do you understand erasure at big data scale?

Show a strong answer

Use the catalog and a pseudonymous key to find all locations. Run row-level deletes on table-format tables (Delta, Iceberg, Hudi), rewrite or expire raw files, vacuum old versions after the retention window, delete derived features and exports, and let immutable backups expire on schedule without restoring erased customers. Record the request and completion. Design ahead: keep PII in few places, separate it from event data, and use keys that make deletion cheap.

Avoid: saying “data lakes are append-only, so we can’t delete”.

Fundamentals · interviewFresher

“What is data governance?”

A common interview and exam question.

The interviewer is checking: can you define it with concrete components and tools?

Show a strong answer

Data governance is the framework of roles, policies and processes that keeps data accurate, understood, secure and used lawfully. Components: ownership and stewardship, a data catalog with business definitions, lineage, classification of sensitive data, quality rules and monitoring, access policies, retention and deletion rules, and compliance with laws such as India’s DPDP Act. Tools include Unity Catalog, Purview, Dataplex, Glue Data Catalog with Lake Formation, DataHub and OpenMetadata.

Avoid: describing governance only as “security”.