Data Engineering
ConceptIntermediate 25 min· Streaming and platforms · 15 of 18

Governance, privacy and the DPDP Act

Learn the pieces of data governance (ownership, catalogs, access, lineage, retention) and what India's DPDP Act, 2023 means for pipelines. Includes masking, pseudonymisation and a deletion-request process. An engineering view, not legal advice.

Every data engineer eventually handles personal data: names, phone numbers, email addresses, order histories, locations. How you store, move and share that data is not only a technical matter. It is a legal and ethical one, and in India it is governed by the Digital Personal Data Protection Act, 2023 (DPDP Act).

This lesson covers what data governance is, the practical tools a data engineer uses (catalogs, access control, masking, lineage, retention), and what the DPDP Act means for your pipelines. It is an engineering introduction, not legal advice. For real compliance decisions, involve your company's legal or privacy team and read the official text.

What is data governance?

Data governance is the set of rules, roles and tools that decide who can use which data, for what purpose, how long it is kept and how its quality is kept up. Think of a college library: books are catalogued (so you can find them), some are in a reference section you cannot borrow (access rules), old ones are removed after a period (retention), and the librarian knows who is responsible for each section (ownership).

Good governance makes data easier to use safely. Bad governance means people either cannot find data or can see data they should not.

The pillars of governance

PillarThe questionWhat a data engineer does
OwnershipWho is responsible for this data?Names an owner and steward for each important table
Catalog and discoveryWhat data exists and what does it mean?Registers tables, columns and descriptions in a catalog
ClassificationHow sensitive is it?Tags columns such as public, internal, personal, sensitive
Access controlWho may see it?Roles, least privilege, row and column rules, masking
LineageWhere did it come from and where does it go?Records sources and downstream users, helps with impact analysis
QualityCan we trust it?Tests, contracts and monitoring (see *Data quality, testing and observability*)
Retention and deletionHow long do we keep it?Automates expiry and deletion

Know your personal data

Personal data is any data about an individual who can be identified from it. In Brew & Bean's orders, customer_name and phone are personal data. An order_id alone is not, but it becomes personal data when it can be linked to a person.

Some data needs extra care: payment details, health, biometric data, precise location, and children's data. Whether a specific field counts as sensitive in law depends on the rules that apply, so classify conservatively and ask your privacy team.

The first practical step is an inventory: which tables and columns hold personal data, where did it come from, who uses it and why. You cannot protect what you have not found. Tag columns in your catalog or even in dbt schema.yml with a meta entry, so the information travels with the model.

models/schema.yml
version: 2

models:
  - name: stg_orders
    description: One row per order, cleaned.
    meta:
      owner: data-team@brewandbean.example
    columns:
      - name: customer_name
        description: Name given at pickup.
        meta:
          classification: personal
      - name: phone
        description: Customer mobile number.
        meta:
          classification: personal
          retention_days: 365
      - name: total
        meta:
          classification: internal

Classification and owner as metadata in dbt. dbt keeps meta values in its generated docs and manifest, so other tools can read them. The retention_days value here is only a label; you still need a job that deletes the data.

The DPDP Act in plain English

The DPDP Act, 2023 is India's law on processing digital personal data. At the time of writing (2026), the Act is in force in stages and its rules set the detailed requirements and timelines. Check the official government sources (MeitY and the Data Protection Board of India) for what applies today. Here are the main ideas that affect data engineers.

Key terms

TermMeaningExample
Data PrincipalThe individual the data is aboutA Brew & Bean customer
Data FiduciaryThe organisation that decides why and how personal data is processedBrew & Bean
Data ProcessorA company that processes data on a fiduciary's behalfA cloud platform or an email service Brew & Bean uses
Significant Data FiduciaryA fiduciary that the government designates because of the volume or sensitivity of data, or other factors; has extra dutiesA very large platform
Data Protection Board of IndiaThe body that handles breaches, complaints and penalties-

Main obligations, in engineering language

- Consent and notice. Personal data is generally processed on the person's consent, which must be free, specific, informed and given by a clear action, with a notice that says what data is collected and why. There are limited "legitimate uses" without consent, such as certain government services or medical emergencies. Your pipeline needs to know which purposes a person agreed to. - Purpose limitation. Use data only for the purpose it was collected for. Pickup orders feeding a delivery tracker is fine. Selling phone numbers to advertisers is not covered by that consent. - Data minimisation. Collect and keep only what you need. If a dashboard needs counts by area, it does not need names. - Accuracy. Keep data complete and correct when it is used for decisions about the person or shared with others. - Storage limitation and erasure. Delete personal data when the purpose is served or consent is withdrawn, unless the law requires you to keep it. - Security safeguards. Take reasonable steps to protect personal data from breaches: encryption, access control, logging, backups. - Breach notification. If a personal data breach occurs, the fiduciary must inform the Board and the affected people in the prescribed way. - Rights of the Data Principal. People can ask for a summary of their data and the processing, request correction and erasure, use a grievance process and nominate someone to exercise rights if they die or cannot act. - Children. For children (under 18 under the Act), verifiable consent of a parent or guardian is required, and tracking, behavioural monitoring and targeted advertising directed at children are restricted. - Cross-border transfers. Transfers outside India are generally allowed except to countries the government restricts by notification. - Penalties. The Act sets financial penalties that can run to hundreds of crores of rupees for serious failures such as inadequate security safeguards. Read the Schedule to the Act for the exact figures.

Not legal advice

Rules, effective dates and thresholds can change, and legal interpretation needs a lawyer. Use this lesson to understand the engineering implications, and always check the official text and your company's privacy team before making a compliance claim.

What the law means for your pipelines

From law to engineering

Legal ideaEngineering practice
Know what you holdInventory and classify personal data in the catalog
Consent and purposeStore consent records (who, what purpose, when, withdrawn or not) as data; join them in queries or filter before use
MinimisationDo not copy personal columns into every table; drop or aggregate them early
Erasure and withdrawalDesign deletion: one place to find a person's rows in every table, plus a job that removes or anonymises them
Storage limitationRetention policies and scheduled deletion of raw data, backups and logs
Security safeguardsEncryption at rest and in transit, least privilege, audit logs, no personal data in code or tickets
Breach readinessKnow which systems hold which data, so you can say who was affected
ProcessorsCheck that cloud and SaaS vendors are covered by contracts and approved for the data they get

Techniques you can use

Least privilege and roles. Give people the minimum access they need, through roles rather than individual grants. An analyst may see order totals but not phone numbers. Review access regularly.

Column masking and row-level security. Many platforms hide or partially show a column depending on the viewer's role, or limit rows to those a user is allowed to see. In Snowflake, for example, you create a masking policy and attach it to a column. Other platforms offer similar features under different names.

Snowflake: mask a phone column by role
CREATE OR REPLACE MASKING POLICY phone_mask AS (val STRING) RETURNS STRING ->
    CASE
        WHEN CURRENT_ROLE() IN ('SUPPORT_LEAD') THEN val
        ELSE CONCAT('******', RIGHT(val, 4))
    END;

ALTER TABLE customers MODIFY COLUMN phone SET MASKING POLICY phone_mask;

Everyone except the SUPPORT_LEAD role sees ******3210 instead of 9876543210. Role names are examples.

Pseudonymisation. Replace a direct identifier with a token so analysts can still count customers or link their orders without knowing who they are. The same input must always give the same token, and the token must not be reversible without a secret key. A plain hash of a phone number is weak: an Indian mobile number has just 10 digits, so there are only a few billion possible values and an attacker can hash them all and look yours up. Use a keyed hash (HMAC) with a secret stored in a secrets manager.

pseudonymise.py
import hashlib
import hmac
import os

SECRET = os.environ.get("PSEUDO_KEY", "change-me").encode()


def pseudonymise(value: str) -> str:
    """Same input always gives the same token, but it cannot be reversed without the key."""
    return hmac.new(SECRET, value.strip().lower().encode(), hashlib.sha256).hexdigest()[:16]


def mask_phone(phone: str) -> str:
    return "******" + phone[-4:]


orders = [
    {"order_id": "A-001", "phone": "9876543210", "total": 330},
    {"order_id": "A-002", "phone": "9876543210", "total": 120},
]
for o in orders:
    print({"order_id": o["order_id"], "customer_token": pseudonymise(o["phone"]),
           "phone_masked": mask_phone(o["phone"]), "total": o["total"]})

Both orders get the same customer_token, so you can count repeat customers without storing the phone number. Set PSEUDO_KEY in the environment; the default is for practice only.

Output with the default practice key
{'order_id': 'A-001', 'customer_token': '75fa89ca7440cc7e', 'phone_masked': '******3210', 'total': 330}
{'order_id': 'A-002', 'customer_token': '75fa89ca7440cc7e', 'phone_masked': '******3210', 'total': 120}

Pseudonymised is not anonymous

Pseudonymised data is still personal data, because whoever holds the key can link it back. Anonymisation, where nobody can identify the person even with extra information, is much harder than it looks: combinations like postcode, age and gender can single people out. Do not call a dataset anonymous unless a privacy expert has reviewed it.

Lineage and catalogs. A catalog lists your tables with descriptions, owners and tags. Lineage shows which sources feed which tables and dashboards. Together they answer "where does the phone number go?" in minutes instead of days. Tools include the lineage in dbt docs, open-source catalogs such as OpenMetadata and DataHub, and the catalogs built into cloud platforms.

Retention and deletion. Write retention into code. A scheduled job deletes raw files and rows older than the retention period. Remember copies: backups, exports, notebooks, log files and analytics tables. Deleting from the main table but not from its copies is a common gap.

Handling an erasure request. The steps below are a typical outline, adapted to your system.

A deletion request, step by step

  1. 1Verify who is asking and find their identifier (such as the customer id).
  2. 2Look up every table that holds that identifier, using your catalog and lineage.
  3. 3Check whether any law requires you to keep some records (for example, invoices for tax). Keep only what is required.
  4. 4Delete or anonymise the rest in all tables, including raw layers and derived tables. In lakehouse tables, remember that the files may keep old versions until cleaned up.
  5. 5Record what was done and when, without storing the personal data itself.
  6. 6Confirm to the person within the required time.

Governance does not need to be heavy

A small team can start simply: a spreadsheet or YAML list of tables with owner and classification, roles instead of shared passwords, masked views for analysts, a retention job for raw data and a short written process for deletion requests. Add a catalog tool when the number of tables makes manual lists unmanageable.

Prompt · Review my table for privacy risks
You are a privacy-aware data engineer. I will describe a table. Identify which columns are personal data, which are risky in combination, and suggest for each: keep, mask, pseudonymise, aggregate or drop. Also suggest a retention period to discuss with the privacy team, and what access roles should see raw values.

Table: [name]
Purpose: [why we keep it]
Columns: [list of column names, types and an example value]
Users: [who queries it]

Do not give legal conclusions. Mark anything that needs a lawyer.

What to expect: Check that the answer separates direct identifiers from combinations, and that it defers legal points to a lawyer or privacy team. Use it as a checklist, not as a ruling.

How this comes up in interviews

Common questions: "How would you handle personal data in a pipeline?", "How do you delete one user's data from a data lake?", "How do you control who sees what in the warehouse?" and "What do you know about the DPDP Act?" A strong answer names the Data Principal and Data Fiduciary roles, consent and purpose, minimisation, security safeguards, breach notification and erasure, then connects each to practice: classification tags, role-based access, masking, pseudonymisation with a keyed hash, retention jobs, and lineage to find every copy. Honesty helps: say it is not your job to interpret the law, but to build systems that make compliance possible.

Try it: Classify and plan

Brew & Bean has a customers table with customer_id, name, phone, email, home_pincode, birth_year, created_at, marketing_opt_in. Classify each column (public, internal, personal), decide for the analyst-facing view whether to keep, mask, pseudonymise or drop it, and name which role may see raw values.

Try it: Design a deletion job

Write down (as a list or a diagram) which tables a deletion request for customer C-123 must touch in the Brew & Bean pipeline from *Project: build an end-to-end data pipeline*, and what you would do with each. Remember raw files, staging, fact tables, report tables and backups.

Governance checklist for a pipeline

  1. Every table with personal data is inventoried, classified and has an owner
  2. Access is by role, with least privilege and regular review
  3. Personal columns are masked or pseudonymised in analyst-facing views
  4. Consent and purpose are stored as data and checked before use
  5. Retention is automated and covers raw layers, copies, backups and logs
  6. You can find and delete one person's data across all tables
  7. No personal data in code, screenshots, tickets or test environments

Key takeaways

  1. Governance means ownership, a catalog, classification, access control, lineage, quality and retention.
  2. The DPDP Act, 2023 covers digital personal data: Data Principals are people, Data Fiduciaries decide why and how data is processed.
  3. Main duties include consent and notice, purpose limitation, minimisation, security safeguards, breach notification, erasure and special care for children's data.
  4. Turn legal ideas into engineering: classification tags, role-based access, masking, retention jobs and deletion processes.
  5. Pseudonymised data is still personal data. Use a keyed hash, not a plain hash, and protect the key.
  6. Check the official text for current rules and timelines. This lesson is not legal advice.

Check yourself

Finishing the quiz marks the lesson as done.

1. Under the DPDP Act, which term describes the organisation that decides why and how personal data is processed?

2. Why is a plain SHA-256 hash of a phone number a weak way to protect it?

3. A dashboard only needs the number of orders per area. What does data minimisation suggest?

4. A customer asks Brew & Bean to delete their data. What is the most important engineering prerequisite for doing this reliably?

5. Which statement about pseudonymised data is correct?

6. What is the best attitude for a data engineer towards legal compliance questions?

Saved on this device. Create a free account to keep it on every device.

Practise this with Sam

A real mock interview, out loud, with an honest scorecard. Free to start.

Start free