---
title: "Copy only the personal columns an analysis · Agent Wranglers"
url: https://agentwranglers.se/playbook/data-engineering/personal-data-in-the-warehouse/warehouse-minimisation
id: DEN-23
level: Required
applies: eu-users
risk: law
updated: 2026-10-22
tokens: 1066
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Copy only the personal columns an analysis needs

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Personal data in the warehouse](https://agentwranglers.se/playbook/data-engineering/personal-data-in-the-warehouse.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-22.

- ID: DEN-23
- Level: Required
- Chapter: [Personal data in the warehouse](https://agentwranglers.se/playbook/data-engineering/personal-data-in-the-warehouse.md)
- Rule: 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.
- 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.
- Risk: A law broken
- Applies when: The project has users in the EU.
- How: 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](https://agentwranglers.se/playbook/data/personal-data/minimal-columns.md) and feeds the [data map](https://agentwranglers.se/playbook/compliance/records-and-data-map/data-map.md).

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### Python example

```python
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

```js
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}`);
}
```

## Sources

- [GDPR Article 5 on principles of processing](https://eur-lex.europa.eu/eli/reg/2016/679/oj)

## Related rules

- DEN-4 [Give every table an owner and a description](https://agentwranglers.se/playbook/data-engineering/warehouse-and-models/table-owners.md) in Data engineering
- DAT-30 [Store only the personal data you need](https://agentwranglers.se/playbook/data/personal-data/minimal-columns.md) in Data and databases
- CMP-7 [Map every store that holds personal data](https://agentwranglers.se/playbook/compliance/records-and-data-map/data-map.md) in Compliance and governance
- DEN-27 [List the warehouse and every BI tool in the data map](https://agentwranglers.se/playbook/data-engineering/personal-data-in-the-warehouse/warehouse-in-data-map.md) in Data engineering
- DEN-29 [Mask personal columns for everyone outside a named role](https://agentwranglers.se/playbook/data-engineering/access-and-bi-tools/column-masking.md) in Data engineering

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/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.

- Next: [Swap direct identifiers for keyed pseudonyms](https://agentwranglers.se/playbook/data-engineering/personal-data-in-the-warehouse/warehouse-pseudonyms.md)
- [Personal data in the warehouse](https://agentwranglers.se/playbook/data-engineering/personal-data-in-the-warehouse.md)
