GDPR Engineering Patterns for Database Systems

Engineering patterns for GDPR data requests, backups, consent, processors, and breach response, with legal scope and implementation limits.

published: reading time: 29 min read author: Geek Workbench updated: November 12, 2026
Quick Summary

This guide covers engineering patterns for data subject requests, backup restores, consent records, processors, and breach response. GDPR duties depend on the request, processing purpose, legal basis, and applicable law; these examples are not a compliance determination. In particular, cryptographic erasure does not automatically settle whether retained backup data meets a controller's obligations.

GDPR Engineering Patterns for Database Systems

This is an engineering pattern guide, not legal advice or a determination that a system complies with the GDPR. The Regulation sets obligations but does not prescribe one database schema or backup design. Controllers must assess each request and processing activity against its purpose, legal basis, the facts, and any applicable Union or Member State law. Have privacy counsel or your data protection officer review decisions that affect retention or data subject rights, and have qualified counsel validate this guide before publication. See the GDPR text and the EDPB’s guidance on respecting individuals’ rights.

flowchart LR
    Request["Erasure request"] --> Assess["Assess grounds, scope,<br/>and any exception"]
    Assess --> Inventory["Find live stores,<br/>recipients, and backups"]
    Inventory --> Live["Erase or restrict<br/>live data as required"]
    Inventory --> Recipients["Notify recipients<br/>when Article 19 applies"]
    Inventory --> Tombstone["Record a minimal<br/>restore suppression event"]
    Tombstone --> Restore["On restore, replay events<br/>after the snapshot"]
    Restore --> Verify["Verify suppression<br/>before serving traffic"]
    Live --> Respond["Respond to requester<br/>within Article 12 timeline"]
    Recipients --> Respond
    Verify --> Respond

Introduction

The GDPR sets requirements for processing personal data, but it does not prescribe one implementation for every system. This guide discusses patterns for erasure requests, portability, consent records, processors, and breach response. Whether a pattern is appropriate depends on the data, the controller’s role, the purpose and legal basis for processing, and the circumstances of the request. For a legal overview, see the GDPR and the EDPB’s data subject rights guidance.

The Core Principles That Drive Technical Decisions

GDPR’s principles that most affect database design:

Lawfulness, fairness, and transparency — Process data only with valid legal basis. Document what you’re doing.

Purpose limitation — Collect data for specified, explicit purposes. Before using it for another purpose, assess compatibility and the legal basis; a new purpose does not always mean consent is required.

Data minimization — Collect only what you need. Not “we might need this later.”

Accuracy — Keep data accurate and up to date. Allow users to correct errors.

Storage limitation — Don’t keep data longer than necessary. Implement retention limits.

Integrity and confidentiality — Protect data appropriately. Encryption, access controls, audit logging.

Accountability — Demonstrate compliance. Document decisions.

These principles inform database design. The legal requirements are set out in Articles 5, 6, 25, and 32 of the GDPR; the pattern chosen still needs a context-specific assessment.

The right to erasure

An erasure request can affect several systems and copies, so start by identifying the data and the legal basis for retaining or erasing it.

What erasure means

Article 17 gives a data subject a right to obtain erasure in specified circumstances. The right is not absolute, and the controller must assess the request against Article 17(1) and the exceptions in Article 17(3) of the GDPR. The grounds include:

  • Data is no longer necessary for the purpose for which it was collected or processed
  • The data subject withdraws consent and there is no other legal ground for processing
  • The data subject objects under Article 21 and there are no overriding grounds, or objects to direct marketing
  • Data was processed unlawfully
  • Erasure is required by a legal obligation
  • Data was collected from a child in relation to an information society service under the conditions in Article 8

Article 17(3) provides exceptions, including cases where continued processing is necessary for:

  • Compliance with a legal obligation or performance of a public-interest task or official authority
  • Freedom of expression and information, or public-health reasons
  • Archiving in the public interest, scientific or historical research, or statistical purposes under Article 89(1), where erasure would make the purpose impossible or seriously impair it
  • Establishment, exercise, or defence of legal claims

These are fact-specific exceptions, not blanket retention permissions. A controller should document the ground and retain only what is necessary. The EDPB’s data subject rights guidance summarizes the erasure grounds and exceptions.

Under Article 12(3), the controller must tell the requester what action it has taken without undue delay and within one month. That period may be extended by up to two further months when necessary because of the complexity or number of requests; the controller must explain the extension within the first month. If Article 17 requires erasure and the data was disclosed to recipients, Article 19 generally requires the controller to inform those recipients without undue delay, unless doing so is impossible or involves disproportionate effort. See Articles 12, 17, and 19 of the GDPR and the EDPB’s guidance on respecting individuals’ rights.

Database Deletion Implementation

An erasure workflow needs an inventory of the relevant data stores and their relationships:

-- Create soft-delete infrastructure
ALTER TABLE users ADD COLUMN deleted_at TIMESTAMP WITH TIME ZONE;
ALTER TABLE users ADD COLUMN deletion_requested_at TIMESTAMP WITH TIME ZONE;

CREATE INDEX idx_users_deleted ON users(deleted_at) WHERE deleted_at IS NOT NULL;

-- Create deletion request table for audit trail
CREATE TABLE deletion_requests (
    id BIGSERIAL PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users(id),
    requested_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
    confirmed_at TIMESTAMP WITH TIME ZONE,
    cascade_to_subsidiaries BOOLEAN DEFAULT true,
    status VARCHAR(20) DEFAULT 'pending'
);

-- Function to handle user deletion request
CREATE OR REPLACE FUNCTION process_deletion_request(request_id INTEGER)
RETURNS void AS $$
DECLARE
    req RECORD;
    deleted_count INTEGER;
BEGIN
    SELECT * INTO req FROM deletion_requests WHERE id = request_id;

    IF req.status <> 'pending' THEN
        RAISE EXCEPTION 'Request already processed';
    END IF;

    -- Mark deletion requested
    UPDATE users SET deletion_requested_at = CURRENT_TIMESTAMP
    WHERE id = req.user_id;

    -- Cascade to related tables (handle carefully)
    UPDATE user_sessions SET deleted_at = CURRENT_TIMESTAMP
    WHERE user_id = req.user_id AND deleted_at IS NULL;

    UPDATE user_preferences SET deleted_at = CURRENT_TIMESTAMP
    WHERE user_id = req.user_id AND deleted_at IS NULL;

    UPDATE user_activity SET deleted_at = CURRENT_TIMESTAMP
    WHERE user_id = req.user_id AND deleted_at IS NULL;

    -- Hard delete after retention period (for truly sensitive data)
    -- This would run via scheduled job after retention period expires

    -- Confirm deletion request
    UPDATE deletion_requests
    SET status = 'completed', confirmed_at = CURRENT_TIMESTAMP
    WHERE id = request_id;

    RAISE NOTICE 'Deletion request % processed for user %', request_id, req.user_id;
END;
$$ LANGUAGE plpgsql;

The Backup Problem

Backups create a recovery problem: a restore can bring back records that were erased from the live system after the backup was taken. The GDPR does not prescribe a backup format or declare a single technical method sufficient. The controller still has to assess its storage-limitation and erasure duties against the data, retention purpose, and applicable law. The GDPR is the source for those obligations; it does not say that keeping encrypted copies or destroying keys automatically satisfies them.

A practical safeguard is a deletion tombstone or suppression log that is applied before a restored system is made available. Keep only the identifier and metadata needed to suppress the record, restrict access to the log, and set its retention period based on the backup lifecycle. The tombstone can itself be personal data, so document its purpose and retention basis.

One restore workflow looks like this:

  1. Record the backup snapshot time and restore it into an isolated environment.
  2. Load erasure events recorded after that snapshot.
  3. Apply those events to every restored table, search index, cache, and derived store in scope.
  4. Verify that the affected records are absent or suppressed, and that processors or downstream copies are handled where required.
  5. Keep the restored system offline until checks pass. If suppression fails, stop the restore and investigate rather than serving the data.
  6. Repeat this exercise with representative backups and keep the results with the recovery runbook.

The controller should also document how long backups remain, who can restore them, and how old snapshots expire. Article 19 generally requires notifying recipients of erasure where applicable, subject to the impossibility or disproportionate-effort exception. The EDPB summarizes this obligation in its guidance on respecting individuals’ rights. A data-protection officer or counsel should review the retention and suppression design for the specific processing activity.

Data Portability: Exporting User Data

Article 20 provides a portability right when processing is automated and based on consent or contract. It covers personal data the person provided, including data observed from their activity; it does not generally cover inferences or other data created by the controller. The EDPB explains the conditions and examples in its guidance on respecting individuals’ rights. Check Article 20 of the GDPR before defining an export’s scope.

Implementing Data Export

import json
from datetime import datetime
from dataclasses import dataclass, asdict
from typing import List

@dataclass
class UserDataExport:
    export_date: str
    user_id: str
    profile: dict
    activity: List[dict]
    preferences: dict
    communications: List[dict]

def export_user_data(user_id: int, db_connection) -> dict:
    """Generate comprehensive user data export"""

    # Gather all user data
    user_data = {
        'export_date': datetime.utcnow().isoformat() + 'Z',
        'user_id': str(user_id),
        'profile': fetch_user_profile(user_id, db_connection),
        'activity': fetch_user_activity(user_id, db_connection),
        'preferences': fetch_user_preferences(user_id, db_connection),
        'purchases': fetch_user_purchases(user_id, db_connection),
        'messages': fetch_user_messages(user_id, db_connection),
    }

    # Format as JSON-LD for machine readability
    export = {
        '@context': 'https://schemas.gdpr-export.example.com/v1',
        '@type': 'UserDataExport',
        **user_data
    }

    return export

def format_export_file(user_data: dict, format: str = 'json') -> bytes:
    """Format export in requested format"""
    if format == 'json':
        return json.dumps(user_data, indent=2).encode('utf-8')
    elif format == 'csv':
        return convert_to_csv(user_data)
    elif format == 'xml':
        return convert_to_xml(user_data)
    else:
        raise ValueError(f"Unsupported format: {format}")

What to Include in Export

For a portability export, first determine which data falls within Article 20. This is narrower than a general access request under Article 15. Depending on the service and data flow, it can include:

  • Account profile information
  • Transaction history
  • Activity logs associated with the account
  • Communications
  • Preferences and settings
  • Data observed from the person’s use of a service, where it meets Article 20’s conditions

Portability does not generally include:

  • Inferred or derived data created by the controller, such as a profile score
  • Data that is not personal data, or data outside Article 20’s consent/contract and automated-processing conditions
  • Other people’s personal data, which must be handled with their rights in mind

When consent is the chosen legal basis, the controller must be able to demonstrate that consent was given. Store enough evidence to reconstruct the notice and action, and provide a withdrawal path. See Article 7 of the GDPR.

-- Consent tracking table
CREATE TABLE consent_records (
    id BIGSERIAL PRIMARY KEY,
    user_id INTEGER NOT NULL,
    consent_type VARCHAR(50) NOT NULL,  -- 'marketing_email', 'data_processing', etc.
    consent_version VARCHAR(20) NOT NULL,  -- Track which version of terms
    granted BOOLEAN NOT NULL,
    granted_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
    granted_ip INET,
    granted_user_agent TEXT,
    withdrawn_at TIMESTAMP WITH TIME ZONE,
    withdrawn_ip INET,
    source VARCHAR(50),  -- 'web_form', 'mobile_app', 'api', 'paper'
    legal_text_hash VARCHAR(64)  -- Hash of terms at time of consent
);

CREATE INDEX idx_consent_user_type ON consent_records(user_id, consent_type);
CREATE INDEX idx_consent_active ON consent_records(user_id) WHERE withdrawn_at IS NULL;

-- Consent change history
CREATE TABLE consent_history (
    id BIGSERIAL PRIMARY KEY,
    consent_record_id INTEGER REFERENCES consent_records(id),
    change_type VARCHAR(20) NOT NULL,  -- 'grant', 'withdraw', 'update'
    changed_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
    ip_address INET,
    user_agent TEXT
);
from functools import wraps
from datetime import datetime

def requires_consent(consent_type: str):
    """Decorator to enforce consent requirement"""
    def decorator(func):
        @wraps(func)
        def wrapper(user_id: int, *args, **kwargs):
            # Check active consent
            consent = db.query("""
                SELECT granted, consent_version, granted_at
                FROM consent_records
                WHERE user_id = %s
                  AND consent_type = %s
                  AND withdrawn_at IS NULL
                ORDER BY granted_at DESC
                LIMIT 1
            """, (user_id, consent_type))

            if not consent or not consent[0]['granted']:
                raise ConsentRequiredError(
                    f"User {user_id} has not granted {consent_type} consent"
                )

            # Log the access for audit
            log_consented_access(user_id, consent_type, func.__name__)

            return func(user_id, *args, **kwargs)
        return wrapper
    return decorator

@requires_consent('marketing_email')
def send_marketing_email(user_id: int, content: str):
    """Send marketing email only if user consented"""
    user = get_user(user_id)
    return email_service.send(user.email, content)

Data Processing Agreements

When a controller uses a processor, Article 28 requires a binding contract or other legal act with specified terms. The agreement should cover the processing’s subject matter and duration, nature and purpose, data types and data subjects, and the parties’ obligations. It must also address the duties listed in Article 28(3), including documented instructions, confidentiality, security, sub-processors, assistance, deletion or return, and audits. See Article 28 of the GDPR. The agreement does not remove the need to assess the controller’s own obligations.

  • What data is processed
  • Purpose of processing
  • How long processing continues
  • Security requirements
  • Sub-processor restrictions
  • Audit rights

Tracking Processors

CREATE TABLE data_processors (
    id SERIAL PRIMARY KEY,
    name VARCHAR(255) NOT NULL,
    legal_entity VARCHAR(255),
    dpa_signed_date DATE,
    dpa_expiry_date DATE,
    data_categories TEXT[],  -- ['personal', 'financial', 'health']
    processing_purposes TEXT[],
    retention_period INTERVAL,
    security_certifications TEXT[],  -- ['SOC2', 'ISO27001']
    last_audit_date DATE,
    contact_email VARCHAR(255)
);

CREATE TABLE processor_data_shares (
    id SERIAL PRIMARY KEY,
    processor_id INTEGER REFERENCES data_processors(id),
    table_name VARCHAR(100),
    data_volume_monthly BIGINT,
    share_started DATE,
    share_ended DATE,
    active BOOLEAN DEFAULT true
);

-- Track controller authorization and notice for sub-processor changes
CREATE TABLE sub_processors (
    id SERIAL PRIMARY KEY,
    parent_processor_id INTEGER REFERENCES data_processors(id),
    name VARCHAR(255) NOT NULL,
    purpose TEXT,
    controller_authorized BOOLEAN DEFAULT false,
    notice_sent_at TIMESTAMP WITH TIME ZONE,
    objection_received_at TIMESTAMP WITH TIME ZONE
);

Article 28(2) requires the processor to obtain the controller’s prior specific or general written authorization before engaging another processor. For general authorization, the processor must inform the controller of intended additions or replacements so the controller can object. This is a controller notice and authorization flow, not a general requirement to notify users or obtain their consent. See Article 28 of the GDPR.

Data Breach Notification

Article 33 does not require notification of every personal data breach. A controller must notify the competent supervisory authority without undue delay and, where feasible, within 72 hours after becoming aware, unless the breach is unlikely to result in a risk to people’s rights and freedoms. Article 34 separately requires communication to affected people without undue delay when the breach is likely to result in a high risk, subject to its exceptions. The controller must document breaches, including those it does not report. See Articles 33 and 34 of the GDPR and the EDPB’s Guidelines 9/2022 on personal data breach notification.

Breach Detection and Response

from datetime import datetime, timedelta
from dataclasses import dataclass
from typing import Optional, List

@dataclass
class DataBreach:
    breach_id: str
    detected_at: datetime
    aware_at: datetime
    description: str
    data_types: List[str]
    user_count: int
    processor_count: int
    status: str  # 'detected', 'investigating', 'contained', 'resolved'
    notification_required: bool
    supervisory_authority: str
    affected_users_notified: bool

class BreachResponseManager:
    def __init__(self, db, notification_service):
        self.db = db
        self.notification_service = notification_service

    def handle_breach_detected(self, breach: DataBreach):
        """Initial breach response workflow"""

        # Log breach
        breach_id = self.record_breach(breach)

        # Record when the controller became aware; assess promptly whether
        # the incident is a personal data breach and what risk it poses.
        self.assess_breach_scope(breach_id)

        # The controller decides whether Article 33 notification is required.
        # If required, notify without undue delay and, where feasible, within
        # 72 hours of awareness. The decision is risk-based, not a fixed
        # user-count or data-category threshold.
        if self.requires_authority_notification(breach):
            notification_target = breach.aware_at + timedelta(hours=72)
            self.schedule_authority_notification(breach_id, notification_target)

        # Article 34 communication is a separate high-risk assessment.
        if self.requires_user_notification(breach):
            self.schedule_user_notification(breach_id)

        # Begin containment
        self.initiate_containment(breach_id)

    def requires_authority_notification(self, breach: DataBreach) -> bool:
        """Apply a documented Article 33 risk assessment for this incident."""
        # Implement this assessment with the controller's privacy and incident
        # response owners. Do not use a fixed record-count or category shortcut.
        return assess_risk_to_people(breach) is not Risk.UNLIKELY

    def draft_authority_notification(self, breach: DataBreach) -> dict:
        """Draft notification to supervisory authority"""
        return {
            'authority': resolve_competent_supervisory_authority(breach),
            'breach_id': breach.breach_id,
            'aware_at': breach.aware_at.isoformat(),
            'description': breach.description,
            'data_types': breach.data_types,
            'approximate_users_affected': breach.user_count,
            'likely_consequences': self.assess_consequences(breach),
            'measures_taken': self.get_containment_measures(breach.breach_id),
            'contact_dpo': 'dpo@company.com'
        }

Breach Notification Template

## Data Breach Notification to [Supervisory Authority]

**Breach Reference:** [Internal reference number]

**Date the Controller Became Aware:** [YYYY-MM-DD HH:MM UTC]

**Date of This Notification:** [YYYY-MM-DD HH:MM UTC]

**Nature of Breach:**
[Description including categories of data and approximate number of
individuals concerned]

**Categories Concerned:**

- [ ] Names
- [ ] Contact details
- [ ] Financial details
- [ ] [Other categories]

**Approximate Number Affected:** [X] individuals

**Likely Consequences:**
[Description of consequences for individuals]

**Measures Taken:**
[Measures already taken or proposed to address the breach]

**Contact:** [Data Protection Officer contact details]

Engineering trade-offs for erasure and backups

These patterns describe system behavior, not whether a particular implementation satisfies the GDPR. A controller must assess the legal basis, retention need, data copies, and applicable law for each case.

Pattern Operational behavior Review before choosing
Hard delete from live stores Removes matching records from the stores included in the operation. A separate backup lifecycle still applies. Inventory replicas, indexes, caches, logs, processors, and backups.
Soft delete followed by purge Hides or marks records in the application, but the personal data remains until the purge runs. Define access restrictions, retention period, and how restore jobs suppress the record.
Per-record encryption and key destruction May make encrypted copies inaccessible if keys are independently managed and no usable copies remain. Do not assume this alone satisfies an erasure request; assess key backups, plaintext copies, metadata, and the legal context.

Production Failure Scenarios

Failure Impact Mitigation
A restore reintroduces records erased after the snapshot Personal data returns to live systems Replay and verify deletion tombstones before serving traffic; test this path and document backup expiry and access controls
Third-party processor data share not tracked Unauthorized retention of user data Maintain processor registry, audit shares quarterly
Consent withdrawal not propagated to all systems Processing may continue without a legal basis if consent was the basis Propagate withdrawal, reassess any other basis, and stop processing where none applies
Data portability export containing other users’ data Cross-user data leak Strict isolation in export query, review before delivery
A breach is reported late or not documented People may remain at risk and the controller may fail its notification duties Keep an incident timeline, make a documented risk assessment, and escalate promptly under Articles 33 and 34

Estimating deletion and restore work

Measure deletion throughput with production-like data. A rough estimate is:

estimated_hours = rows_to_process / measured_rows_per_second / 3600

Include related tables, indexes, replicas, retries, lock time, and downstream stores in the measurement. Run a dry exercise before relying on the estimate. The one-month period in Article 12 is a deadline to respond to a data subject request, not a universal technical deadline for every deletion job. If a request needs more time, Article 12(3) sets the conditions for an extension and requires the controller to inform the requester within the first month. See the GDPR and the EDPB’s rights guidance.

Quick Recap Checklist

Use this engineering checklist to prepare a review with the controller’s privacy lead or counsel. It does not establish compliance:

  • Map personal data stores, purposes, legal bases, recipients, and retention periods
  • Document how erasure requests are assessed, executed, and answered
  • Test that backup restores replay deletion suppressions before traffic is served
  • Track processor and recipient notifications when Article 19 applies
  • Record consent evidence when consent is the chosen legal basis
  • Define a risk-based breach assessment and escalation path for Articles 33 and 34
  • Determine whether an export request meets Article 20’s portability conditions
  • Review retention schedules and deletion jobs against the relevant legal basis

Technical architecture considerations

Data inventory, access controls, retention, restore procedures, and request handling belong in system design. The GDPR’s design and security requirements appear in Articles 25 and 32; the implementation depends on the processing context.

Data Classification

from enum import Enum

class DataCategory(Enum):
    PUBLIC = "public"           # No restrictions
    INTERNAL = "internal"       # Internal use only
    CONFIDENTIAL = "confidential"  # Access controlled
    RESTRICTED = "restricted"   # Maximum protection

# Map database columns to categories
COLUMN_CLASSIFICATION = {
    'users.email': DataCategory.CONFIDENTIAL,
    'users.ssn': DataCategory.RESTRICTED,
    'users.phone': DataCategory.CONFIDENTIAL,
    'users.address': DataCategory.CONFIDENTIAL,
    'transactions.amount': DataCategory.CONFIDENTIAL,
    'transactions.card_last_four': DataCategory.RESTRICTED,
    'activity_logs.ip_address': DataCategory.CONFIDENTIAL,
}

Retention Enforcement

The periods below are example configuration values, not GDPR retention rules. Set and review each period against the purpose, legal basis, and applicable law.

-- Create retention policies
CREATE TABLE retention_policies (
    id SERIAL PRIMARY KEY,
    table_name VARCHAR(100) NOT NULL,
    column_name VARCHAR(100),  -- NULL means use table-level retention
    retention_period INTERVAL NOT NULL,
    legal_basis VARCHAR(255),  -- Why this retention period
    review_date DATE,
    active BOOLEAN DEFAULT true
);

INSERT INTO retention_policies (table_name, column_name, retention_period, legal_basis)
VALUES
    ('user_sessions', NULL, INTERVAL '30 days', 'Session management'),
    ('user_activity', NULL, INTERVAL '1 year', 'Analytics (anonymized after 90 days)'),
    ('support_tickets', NULL, INTERVAL '3 years', 'Customer service records'),
    ('financial_transactions', NULL, INTERVAL '7 years', 'Tax and legal compliance'),
    ('consent_records', NULL, INTERVAL '10 years', 'Proof of consent'),
    ('audit_logs', NULL, INTERVAL '5 years', 'Security and compliance');

Interview Questions

These scenarios are for engineering discussion. Their answers describe implementation patterns; they do not determine an individual’s rights or an organization’s legal obligations.

1. A user exercises their right to erasure. Their data spans 50 tables with complex foreign key relationships. How do you implement this?

Begin with an inventory and a case-specific assessment under Article 17. Erase or restrict live data as required, handle recipient notifications where Article 19 applies, and test backup suppression before restored data is served. Batch size is an engineering choice based on measured workload. Per-record encryption may be one safeguard, but destroying a key does not by itself establish that the request has been satisfied. See the [GDPR](https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32016R0679) and the EDPB's [rights guidance](https://www.edpb.europa.eu/sme/be-compliant/respect-individuals-rights_en).

2. A person asks for erasure while backups have a five-year retention period. How should the team assess the request and restore risk?

The GDPR does not prescribe one backup deletion method or create a blanket backup exception. The controller must assess the erasure request, any Article 17(3) exception, storage limitation, applicable law, and the system's recovery design. Document how long backups remain and who can restore them; replay and verify deletion tombstones before a restored system serves traffic. Cryptographic erasure may be considered, but it is not automatically sufficient in every case. See Articles 5, 17, and 19 of the [GDPR](https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32016R0679).

3. A person who meets Article 20's conditions requests portability. Their data spans orders, preferences, and activity logs. How do you scope the export?

First check whether Article 20 applies: processing must be automated, based on consent or contract, and concern data the person provided or that was observed from their use of a service. This right is narrower than access under Article 15 and generally excludes controller-created inferences. Export the in-scope data in a reusable machine-readable format, protect other people's rights, and document the schema. JSON and CSV are examples, not mandatory formats. The EDPB explains the [portability conditions](https://www.edpb.europa.eu/sme/be-compliant/respect-individuals-rights_en).

4. Your company is acquired mid-operation. How do you handle the acquired company's GDPR obligations for data that came from EU users?

An acquisition does not automatically require fresh consent or authorize every new use. Map the processing and determine which entities act as controllers or processors, whether the purpose and legal basis remain valid, and what transparency or contract updates are needed. Do not merge or repurpose data until those questions are assessed. Articles 5, 6, 13, 14, and 28 of the [GDPR](https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32016R0679) provide the relevant framework; get legal review for the transaction.

5. A user claims they never gave consent for marketing emails, but your consent_records table shows they did. How do you investigate and resolve?

A timestamp, version, source, and hash can help reconstruct the consent flow, but a hash alone does not prove what the person saw or that consent was freely given, specific, informed, and unambiguous. Preserve the actual notice or a durable versioned copy, the action recorded, and the withdrawal path. If the evidence is incomplete, assess the processing basis and honor a valid withdrawal. See Article 7 of the [GDPR](https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32016R0679).

6. Your organization discovers a data breach affecting 50,000 EU user accounts. Walk through the technical steps of GDPR breach response.

Contain the incident, preserve evidence, and assess whether personal data were compromised and the likely risk to people. Article 33 notification is generally due without undue delay and, where feasible, within 72 hours of awareness unless the breach is unlikely to create a risk. Article 34 communication to affected people applies when the breach is likely to create a high risk, subject to exceptions. There is no fixed user-count or data-category shortcut; document the assessment and use phased reporting if needed. See the [GDPR](https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32016R0679) and the EDPB's [breach-notification guidance](https://www.edpb.europa.eu/our-work-tools/our-documents/guidelines/guidelines-92022-personal-data-breach-notification-under-gdpr_en).

7. How do you implement data minimization when your analytics team needs aggregate user behavior data?

Use only data needed for the stated purpose, and assess whether the resulting aggregates still identify people when combined with other information. There is no universal minimum group size that guarantees anonymization. A 90-day retention period is an example policy, not a GDPR rule; choose and document a period that fits the purpose and legal basis. The GDPR's data-minimization and storage-limitation principles are in Article 5, and Recital 26 discusses identifiability. See the [GDPR text](https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32016R0679).

8. A user exercises their right to erasure, but their data has been pseudonymized and is used for ML model training. Are you required to act?

Pseudonymized information remains personal data when it can be attributed to a person using additional information. Whether an erasure request requires changing a trained model depends on the data, the model's ability to identify or reveal information about a person, and the applicable grounds and exceptions. The GDPR does not prescribe retraining or machine unlearning as a universal response. Assess the source records, model, and outputs with privacy counsel; document the decision. See Article 4(5), Recital 26, and Article 17 of the [GDPR](https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32016R0679).

9. A user exercises their right to erasure, but their data has been anonymized and aggregated into statistical reports. Are you required to act?

Data that has been irreversibly anonymized so no person is identifiable may fall outside the GDPR, but aggregation alone does not make data anonymous. Assess whether a person can be identified using means reasonably likely to be used, including linkage with other information. Apply any erasure request to source records where required before they are aggregated, and test for re-identification risk. See Recital 26 and Article 17 of the [GDPR](https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32016R0679).

10. Your company processes personal data of EU residents from multiple EU member states. Which supervisory authority has jurisdiction?

For qualifying cross-border processing, the one-stop-shop can make the supervisory authority at the controller's or processor's main establishment the lead authority. It does not apply to every case, and the competent authority depends on the processing and establishment facts. An organization without an EU establishment may also have representative obligations under Article 27. Map the relevant authorities with counsel rather than assuming every Member State has jurisdiction or that registration is always required. See Articles 27, 55, and 56 of the [GDPR](https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32016R0679).

11. How do you implement data portability for a complex data model where user data spans dozens of tables with many-to-many relationships?

Build the export around the data that meets Article 20's portability conditions, rather than walking every relationship in the database. Preserve useful relationships and metadata, exclude or protect other people's data, and document what the export contains. A separate access request under Article 15 may have a different scope. See the EDPB's [portability guidance](https://www.edpb.europa.eu/sme/be-compliant/respect-individuals-rights_en).

12. Your company uses a cloud-based CRM that processes EU personal data. What are your GDPR obligations as a data controller versus the CRM vendor?

The parties' roles depend on what they actually do. A controller determines purposes and means; a processor acts on the controller's documented instructions and must meet its own duties, including those in Articles 28 and 32. The Article 28 agreement should specify the required terms and assistance. It does not transfer all controller responsibilities to the CRM vendor, and liability depends on the facts and applicable provisions. See Articles 24, 28, and 32 of the [GDPR](https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32016R0679).

13. A DPO (Data Protection Officer) is required for your organization. What are the key responsibilities and how do you ensure the role is effective?

A DPO is required only in the circumstances listed in Article 37, including certain large-scale systematic monitoring or large-scale processing of special-category data. Articles 38 and 39 cover the DPO's position and tasks: the DPO must be involved appropriately, have resources, and perform the role without instructions on its tasks. The controller remains responsible for compliance decisions. Check Articles 37–39 of the [GDPR](https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32016R0679).

14. How do you handle GDPR's requirements when personal data is used for machine learning model training?

For model training, identify the purpose, legal basis, data categories, retention, and whether the use is compatible with the original purpose. A new purpose does not automatically mean fresh consent is the only option; assess the applicable legal basis and transparency duties. If someone requests erasure, evaluate source data, training artifacts, model outputs, and whether the model itself contains or can reveal personal data. The GDPR does not set a universal model-retraining rule. See Articles 5, 6, 13–14, and 17 of the [GDPR](https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32016R0679).

15. Your company is launching a feature that collects location data. What privacy questions should be resolved before launch?

Location data is not automatically special-category data under Article 9. Assess the purpose, legal basis, precision, retention, and risk to people. A data protection impact assessment is required before processing that is likely to result in high risk under Article 35; location collection does not trigger that rule in every case. Build the feature only after the controller has assessed necessity, safeguards, transparency, and any DPIA result. See Articles 6, 9, and 35 of the [GDPR](https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32016R0679).

16. A user requests deletion of their data, but a regulatory requirement (tax law) mandates retention for 7 years. How do you reconcile these?

If a specific legal obligation requires retaining particular records, Article 17(3)(b) may apply. Confirm the obligation and its scope with counsel, retain only what it requires, restrict other use, and explain the decision to the requester. Record the request and schedule deletion when the retention requirement ends. A legal retention rule is not a blanket reason to keep every field or copy. See Articles 12 and 17 of the [GDPR](https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32016R0679) and the EDPB's [rights guidance](https://www.edpb.europa.eu/sme/be-compliant/respect-individuals-rights_en).

17. How do you implement privacy by design when building a new database schema for a user-facing application?

Start by documenting the purpose and legal basis for each field, then minimize collection, separate identifiers where useful, set reviewable retention periods, and restrict access. Design request handling and restore suppression into the system. A soft-delete flag alone does not erase personal data. Article 25 of the [GDPR](https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32016R0679) covers data protection by design and by default.

18. Your company experiences a ransomware attack. Ransomware operators demand payment in exchange for not publishing exfiltrated personal data. What are your GDPR breach notification obligations?

Treat ransomware as an incident requiring prompt investigation. Encryption or loss of availability can be a personal data breach even if exfiltration is not established; do not assume that data was or was not accessed. Document the evidence and assess risk to people. Notify the supervisory authority under Article 33 where required, generally without undue delay and, where feasible, within 72 hours of awareness; communicate with affected people without undue delay if the breach is likely to create a high risk, subject to exceptions. See the [GDPR](https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32016R0679) and the EDPB's [breach-notification guidance](https://www.edpb.europa.eu/our-work-tools/our-documents/guidelines/guidelines-92022-personal-data-breach-notification-under-gdpr_en).

19. How do you handle GDPR compliance for a company acquisition where the acquired company's EU user database is merged into the acquirer's systems?

Treat the acquisition as a trigger for a data and role review, not as automatic permission to combine or repurpose records. Identify controllers and processors, purposes, legal bases, recipient arrangements, retention, and required notices. If the planned use is new, assess compatibility and legal basis before migration. See Articles 5, 6, 13, 14, and 28 of the [GDPR](https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32016R0679); obtain legal review for the transaction.

20. Your company uses third-party analytics that receives personal data in the clear via JavaScript tracking. What are the compliance risks and mitigations?

Map whether the analytics vendor acts as a processor or an independent controller, and document the relevant responsibilities. If it is a processor, use an Article 28 agreement; assess international transfers under Chapter V where applicable. Minimize or transform data before sharing, but do not call it anonymous unless re-identification is not reasonably likely. Certifications can inform due diligence, but they do not by themselves establish GDPR compliance. See Articles 28 and 44–49 of the [GDPR](https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32016R0679).


Further Reading


Conclusion

Request handling and recovery need to be designed together. Inventory the data, assess each request, notify recipients where required, and test that a restore does not reintroduce erased records. Consent records should let the controller reconstruct the notice and action; they do not need to be immutable in every system.

These patterns support engineering work, but they do not decide whether a controller has met its legal obligations. Review the current GDPR text, the EDPB’s guidance on individuals’ rights, and the EDPB breach-notification guidance with qualified privacy counsel before relying on a specific design.

For related engineering patterns, see data masking, audit logging, and encryption at rest.

Category

Related Posts

Data Masking Strategies for Non-Production Environments

Learn static and dynamic data masking: nulling, shuffling, hashing, and range techniques. Understand GDPR and PII considerations for PostgreSQL and Oracle.

#database #data-masking #security

PII Handling: Protecting Personal Data in Data Systems

Learn how to inventory personal data, limit access, set retention rules, and choose protection controls for data systems.

#data-engineering #pii #data-protection

PostgreSQL Audit Logging: Triggers, CDC, and pgAudit

Compare PostgreSQL triggers, logical decoding, and pgAudit for tracking order updates, including event fields, rollback behavior, ordering, and capture limits.

#database #audit #compliance