Skip to contentManaged Kafka is live: Apache Kafka on AWS for half the cost of MSK

Data Classification

Data classification labels data by what it contains and how sensitive it is, so access, masking and retention rules can follow the label.

What Is Data Classification?

Data classification is the practice of labeling data by what it contains and how sensitive it is, so that access, masking and retention rules can follow the label. In a data stack the unit is usually the column: users.email is labeled PII and confidential, and every copy of that column should carry the same label.

Labels describe two things:

  • Sensitivity level: how much harm exposure would cause, such as public, internal, confidential or restricted.
  • Data type: what the value is, such as PII (names, email addresses, IP addresses, government IDs), PHI under HIPAA, payment card data under PCI DSS, credentials and secrets, or confidential business data like salaries.

How Data Classification Works

Data classification runs in three steps: discovery proposes labels, labeling records them, and enforcement applies controls based on them.

  1. Discovery. A scanner reads schemas, and often values, to find sensitive columns. Snowflake's sensitive data classification (Enterprise Edition) gives each such column a semantic category, such as NAME, and a privacy category of IDENTIFIER, QUASI_IDENTIFIER or SENSITIVE (Snowflake docs).
  2. Labeling. A rule or a reviewer confirms the label and stores it as metadata: a Snowflake tag, a BigQuery policy tag or a data catalog entry.
  3. Enforcement. A Snowflake tag-based masking policy masks every tagged column whose data type matches the policy (masking policy docs). BigQuery checks a column's policy tag against IAM at query time (BigQuery docs).

One column, from Postgres to the warehouse

Take users.email in a production Postgres database:

  • In Postgres, the column is labeled PII and confidential.
  • In replication, a change data capture pipeline reads changes from the WAL, Postgres's write-ahead log, and writes them to raw.users in Snowflake. The label is metadata and does not travel with the rows.
  • In transformation, dbt builds stg_users, dim_customers and a marketing export from raw.users. All three now hold email addresses.

That makes four copies outside Postgres. Data lineage finds them by listing every column derived from users.email. Database replication copies personal data out of production, so the label has to be applied again in the warehouse.

Data Classification Levels

A common scheme has four sensitivity levels. Names vary, but the tiers map closely:

LevelExamplesTypical handling
PublicPublished docs, list prices, marketing pagesNo restrictions
InternalWiki pages, org charts, aggregate metricsEmployees only, no external sharing
ConfidentialCustomer emails, contracts, revenue by accountRole-based access, masked outside production, reads logged
RestrictedGovernment IDs, card numbers, health records, credentialsNeed-to-know access, excluded or encrypted in analytics copies, every read audited

A column takes the level of the most sensitive value it can hold. A notes field that sometimes contains a phone number is confidential. Keep the number of tiers small, since every extra one adds borderline calls.

Where Name-Based PII Discovery Falls Short

Name-based scanning flags columns whose names or types match patterns such as email, phone, ssn, dob or ip_address. It needs only schema metadata and finds the obvious columns quickly. It is a heuristic, and it gets four kinds of column wrong:

  • Free-text fields. notes and comments columns collect phone numbers that support agents paste in.
  • JSON and JSONB columns. A metadata column holding {"email": "..."} has a name that reveals nothing.
  • Vague or legacy names. contact, val or c7 hide their contents, and a column renamed in a migration can lose its match.
  • False positives. email_template_id and phone_verified match the pattern and hold no personal data.

Content sampling closes part of the gap by testing values against regular expressions, checksums such as the Luhn check for card numbers, or ML models. Sampling costs compute and only sees the rows it reads. Treat name-based results as the first draft of the inventory and have column owners confirm anything labeled restricted.

Classifying Data in Replication Pipelines

A replication pipeline decides which personal data reaches the warehouse at all. In-flight controls change what lands; warehouse controls change who can read it. There are four options:

  • Exclude the column. It never reaches the destination, and analysts lose the field.
  • Hash the column. A deterministic hash keeps joins, counts and deduplication working without the raw value.
  • Encrypt the column. Encryption is reversible with the key, for teams that need the original value back.
  • Mask in the warehouse. The raw value lands, and a masking policy hides it at query time. The value still sits in storage, backups and any table copied from it.

CDC pipelines differ in how they handle schema changes, so check what happens to columns added later. With an exclusion list, a new tax_id column lands unprotected. An inclusion list keeps it out until someone adds it.

Data Classification Best Practices

Data classification holds up when labels start at the source and are re-checked every time the schema changes.

  • Label at the source. Application teams know what each column holds, and lineage carries the labels downstream.
  • Re-scan after schema changes. A migration that adds tax_id creates an unlabeled restricted column. Run PII discovery on new and altered columns.
  • Minimize before you mask. If analytics never needs the raw value, exclude or hash it in the pipeline.
  • Scan derived tables and exports. dbt models, reverse ETL syncs and CSV exports copy labeled columns into places a scan of raw tables never reaches.
  • Keep audit evidence. An auditor may ask which controls applied to a column, and since when. Version the labels, and keep a change history of the tables, as in audit logs built with CDC and SCD Type 2.

How Artie handles this

Artie Catalog flags likely personal data in the databases and warehouses you connect. It matches column names for emails, people's names and credentials, and Postgres's inet type for IP addresses. It doesn't read the values, so free-text and JSON columns still need a person to check them. In a pipeline, you can exclude, hash or encrypt columns before they reach the destination. Hashing and encryption aren't available for Kafka destinations.

Frequently asked questions

What is data classification?

Data classification is labeling data by type and sensitivity, usually column by column, so that access controls, masking and retention rules follow the label. A typical scheme marks a column of email addresses as PII and confidential and restricts who can read it.

What is GDPR data mapping?

GDPR data mapping is an inventory of the personal data an organization holds: where it is stored, where it flows, and why it is processed. It supports the records of processing activities that Article 30 of the GDPR requires. Classification finds the personal data in each system, and data lineage traces the flows.

Can column names alone identify PII?

Column names alone identify only part of the PII in a database. Name rules catch columns like email or ssn, but miss free-text fields, JSON columns and vaguely named columns, and they can flag lookalikes such as email_template_id. Content sampling and owner review are needed to complete the inventory.

Does hashing a column make the data anonymous?

Hashing a column pseudonymizes data but does not anonymize it. Under GDPR, pseudonymized data remains personal data for anyone who can re-identify it, and unsalted hashes of emails or phone numbers can be reversed by hashing likely values and comparing results. A secret salt, as in HMAC-SHA256, makes that attack much harder.

Watch your data replicate live