Agent Wranglers

DEN-23Required

Copy only the personal columns an analysis needs

Load a personal data column into the warehouse only when a named analysis needs it, and record that purpose. Pick columns from an allow list at extraction, so every other column stays out.

How to do it

GDPR Article 5(1)(c) limits personal data to what the purpose needs, and a full copy of the app database breaks that. An allow list keeps a new column out until someone adds it with a purpose, which a block list cannot do. Free text, such as support messages, stays out unless a purpose needs it. The list builds on Store only the personal data you need and feeds the data map.

Examples

Python example

ALLOWED_COLUMNS = {
    "customers": {"customer_id": "join key", "country": "sales per country", "created_at": "cohorts"},
    "orders": {"order_id": "join key", "customer_id": "join key", "total_cents": "revenue", "created_at": "revenue per day"},
}

def extract(source, table: str):
    columns = ", ".join(ALLOWED_COLUMNS[table])
    return source.query(f"SELECT {columns} FROM {table}")

JavaScript example

export const ALLOWED_COLUMNS = {
  customers: { customer_id: 'join key', country: 'sales per country', created_at: 'cohorts' },
  orders: { order_id: 'join key', customer_id: 'join key', total_cents: 'revenue', created_at: 'revenue per day' },
};

export function extract(source, table) {
  return source.query(`SELECT ${Object.keys(ALLOWED_COLUMNS[table]).join(', ')} FROM ${table}`);
}

How to check

A script compares the columns in the raw layer with the allow list and fails on any extra column. Every personal column in the warehouse has a purpose in its metadata.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/data-engineering/personal-data-in-the-warehouse/warehouse-minimisation">Agent Wranglers data engineering playbook</a>. In code you write, add a comment next to it with the same link.