🎉 75% of content is free forever — Unlock Premium from $10/mo →
CW
NEWSLIVESearch All Content
đŸ’ŧ Servicesâ„šī¸ Aboutâœ‰ī¸ ContactView Pricing Plansfrom $10

Data Governance: Dataplex, DLP & Policy Tags

GCP Data EngineeringData GovernanceđŸŸĸ Free Lesson

Data Governance on GCP

Master data governance on GCP including Dataplex, Cloud DLP, policy tags, access controls, and compliance frameworks.

18 min readAdvanced

What You'll Learn

  • 1Separate governance, compliance and security and name the tool that owns each
  • 2Attach policy tags to columns and prove that a restricted user sees null
  • 3Run Cloud DLP inspection and de-identification against a BigQuery table
  • 4Set up Dataplex zones, quality rules and lineage for a domain owned dataset

Governance Is Four Questions, Not One Project

Data governance fails when it is treated as a single large programme instead of four separable questions that can be answered and enforced independently. Who owns this dataset, and who may change it. What does it contain, and how sensitive is that. How long must it be kept, and how is it disposed of. Whether a given action is permitted right now, and can it be proven afterwards. Ownership and documentation are catalog work, sensitivity is classification and de-identification work, retention is lifecycle work, and enforcement is IAM, policy tags and organization policy.

The GCP services map onto those questions rather than onto a hierarchy, which is why a governance design reads more like a wiring diagram than an org chart. Dataplex discovers assets, runs quality rules and records lineage; Data Catalog or the Dataplex Universal Catalog holds the metadata and the tag templates that describe a column; Cloud DLP inspects payloads for identifiers and can mask or tokenize them; IAM and policy tags decide who sees what at query time; and Cloud Audit Logs records the attempt. A governance review should be able to point from each question to the service that answers it and to the log that proves the answer.

Governance questionGCP mechanismEnforced atEvidence produced
Who owns and where is itDataplex assets, tag templatesCatalogCurated entries with owners
What is insideCloud DLP inspectionIngest and scheduled scanFindings by info type
How sensitiveClassification policy tagsBigQuery columnTag on the schema
Who may read itIAM on tags and viewsQuery timePolicy denied audit log
How long keptBucket lifecycle, table expirationStorageLifecycle report
Was it used properlyCloud Audit Logs, Data Access logsAny API callImmutable audit trail

Classification and Policy Tags

Policy tags are the point where a classification stops being documentation and starts being enforcement. A taxonomy is a tree of tags, each tag can carry an IAM policy, and a BigQuery column bound to a tag inherits that policy: a principal without the tag role reads NULL for that column rather than receiving an error, which keeps queries working for everyone else while removing the value for the person who should not have it.

gcloud datacatalog taxonomies create \
  --project=my-project \
  --location=us-central1 \
  --display-name="Data Classification" \
  --description="Policy tags for data classification"

gcloud datacatalog policy-tags create \
  --project=my-project \
  --location=us-central1 \
  --taxonomy=1234567890 \
  --display-name="Restricted" \
  --description="Highly sensitive PII and PHI"

gcloud datacatalog policy-tags create \
  --project=my-project \
  --location=us-central1 \
  --taxonomy=1234567890 \
  --parent=1111111111 \
  --display-name="Email" \
  --description="Direct contact identifier"
-- Bind the tag to the column that must be protected
ALTER TABLE `project.dataset.users`
ALTER COLUMN email
SET OPTIONS (
  policy_tag = 'projects/my-project/locations/us-central1/taxonomies/1234567890/policyTags/456'
);

Two details decide whether this works in production. Tags live on the column definition, so every consumer path, including Looker, exports and application queries, sees the restriction without needing its own logic. And the grant is usually written as roles/bigquery.dataViewer on the tag for the analytics group while the underlying table stays restricted, which means adding a colleague to a reporting group is a one line change rather than a table level permission review.

Discovering and Masking Sensitive Values

You cannot protect what you have not found, and Cloud DLP is the discovery engine: it scores content against more than a hundred built in detectors for email addresses, phone numbers, credit card numbers, national identifiers and custom regex patterns, then reports the likelihood of each finding.

python
from google.cloud import dlp_v2

client = dlp_v2.DlpServiceClient()

def inspect_data(project_id, content):
    inspect_config = {
        "info_types": [
            {"name": "EMAIL_ADDRESS"},
            {"name": "PHONE_NUMBER"},
            {"name": "CREDIT_CARD_NUMBER"},
            {"name": "US_SOCIAL_SECURITY_NUMBER"}
        ],
        "min_likelihood": "LIKELY",
        "include_quote": True
    }
    response = client.inspect_content(
        request={
            "parent": f"projects/{project_id}",
            "inspect_config": inspect_config,
            "item": {"value": content}
        }
    )
    return response.result.info_type_inspections

def deidentify_data(project_id, content):
    deidentify_config = {
        "info_type_transformations": {
            "transformations": [{
                "info_types": [{"name": "EMAIL_ADDRESS"}],
                "primitive_transformation": {
                    "character_mask_config": {
                        "masking_character": "*",
                        "number_to_mask": 0,
                        "reverse_order": False
                    }
                }
            }]
        }
    }
    response = client.deidentify_content(
        request={
            "parent": f"projects/{project_id}",
            "deidentify_config": deidentify_config,
            "item": {"value": content}
        }
    )
    return response.result.item.value

Inspection scales: the same configuration runs against a single string, an object in Cloud Storage, or a BigQuery table through a DLP job that scans a column and writes findings back into a table. Masking replaces a value with a symbol, which is enough for a support console but destroys analytics value; tokenization keeps a stable surrogate so a join across tables still works; and format preserving encryption keeps the shape of a credit card number so validation logic still passes. The choice is driven by what the downstream query needs to do with the column after protection.

Dataplex: Zones, Quality and Lineage

Dataplex is the governance layer over the storage you already have. A lake groups zones, a zone isolates a domain's assets and carries the default policies for them, and an asset attaches a BigQuery dataset or a Cloud Storage bucket to the zone so discovery and rules apply from that moment. Raw zones typically accept anything, curated zones require a schema and quality gate, and the promotion of a dataset from raw to curated is then an auditable event rather than a Slack message.

Quality rules are declarative: a row count must stay within a band of the trailing average, a column must not be null, a key must be unique, a value must fall in a range, or a custom SQL expression must hold. Each rule produces a result that Dataplex stores, and the failure can raise an alert through Cloud Monitoring instead of silently letting bad data flow into a dashboard. Lineage closes the loop: when a Dataflow job or a BigQuery query moves data from one asset to another, the recorded edges let an owner answer what breaks downstream if this table changes today, which is the question every incident eventually asks.

Retention, Deletion and Proof

Retention schedules turn a policy into storage behaviour. BigQuery tables take an expiration time, and a partitioned table can expire individual partitions, which is how a nine year regulatory requirement coexists with a ninety day working set in the same table. Cloud Storage objects move through lifecycle classes and can be deleted outright, while a retention policy on the bucket prevents even an owner from removing them early. Deletion requests then become a procedure rather than a scramble: locate every store holding the identifier, delete current rows, allow the BigQuery time travel window of up to seven days to lapse or overwrite deliberately, confirm that exports and backups follow the same schedule, and record the outcome.

Proof is the second half. Data Access audit logs record who read which table, but they are chargeable and are therefore off by default, so the decision to enable them belongs in the design for sensitive datasets rather than after an incident. Logs should be exported to a bucket or project the data owners cannot edit, because an audit trail held in the same project it monitors is only as durable as that project's permissions.

✨

Best Practice: Classify first with a four level Public, Internal, Confidential, Restricted scheme, then bind policy tags to the columns that carry the top two levels, then enable Data Access audit logs on exactly those datasets. Run Cloud DLP on a schedule rather than once, and review tag grants quarterly so stale access disappears with the person who requested it.

Common Interview Questions

Q1: What are the key components of data governance?

Answer: Ownership and stewardship, a classification scheme, a catalog for discovery, quality rules with measurable thresholds, lineage for impact analysis, retention and deletion schedules, access control, and audit evidence. On GCP these map to Dataplex, tag templates, Cloud DLP, policy tags, IAM and Cloud Audit Logs respectively.

Q2: How does column level security work in BigQuery?

Answer: A column is bound to a policy tag, and the tag carries the IAM policy that grants read access. A user without the tag permission selects the table normally and receives NULL in the restricted column, so the rest of the query still runs and the restriction is visible in the policy denied audit log.

Q3: When should Cloud DLP run?

Answer: At ingestion for a first inventory, on a schedule for drift and newly introduced identifiers, before a dataset is shared outside its domain, and on a copy destined for a non-production environment where masking or tokenization must be applied first.

Q4: How do you satisfy a GDPR deletion request across a lake and a warehouse?

Answer: Enumerate every store with the Data Catalog, delete the live rows in BigQuery and the documents in the operational store, wait out or explicitly clear the time travel window, apply the same rule to exports in Cloud Storage, scan residuals with Cloud DLP, and log the request identifier with each step for the audit file.

Q5: What is the purpose of audit logs here?

Answer: Audit logs answer whether the controls are actually being used. Admin Activity logs are free and always on, Data Access logs show who read a sensitive table and must be enabled deliberately, and exporting both to a separate project keeps the evidence outside the reach of the accounts it monitors.

Interview Questions

Q1: Why does a restricted column return NULL instead of an error?

Policy tag access is checked as part of the query, and BigQuery blanks the column rather than failing the statement so that one protected field does not break a dashboard built by a team with legitimate access to the rest of the table.

Q2: What is the difference between masking and tokenization?

Masking removes the value permanently, which is fine for display but breaks joins; tokenization replaces it with a stable surrogate so downstream grouping and reconciliation still work while the original is withheld.

Q3: How does a Dataplex zone express a domain boundary?

Assets registered to a zone inherit its default policies and its quality rules, so a sales domain owns its curated zone, a promotion from raw to curated is an explicit move, and cross-domain access is granted at the zone rather than per table.

Q4: Where should audit logs live?

In a separate project or bucket that the identities being monitored cannot write to or delete, because evidence stored where it can be edited proves nothing to an auditor.

Common Mistakes

Writing the classification policy in a document and never binding it to the schema

Fix: Attach policy tags to the columns, because an unenforced classification is a suggestion that expires when the team changes.

Scanning for sensitive data once during a migration

Fix: Schedule Cloud DLP inspection, since new columns and new source systems reintroduce identifiers every quarter.

Granting table level read access to share a dataset with analysts

Fix: Grant on the tag or the authorized view so the restriction travels with the column into Looker, exports and applications.

Key Takeaways

  • Governance splits into ownership, sensitivity, retention and enforcement, and each has a specific GCP service plus an audit trail
  • Policy tags enforce classification at query time by returning NULL to anyone without the tag role instead of failing the query
  • Cloud DLP discovers identifiers and offers masking, tokenization or format preserving protection depending on what queries must still work
  • Dataplex zones, quality rules and lineage turn ownership into something a platform enforces and an auditor can inspect
CW

ChatWhole Learn Editorial Team

Written by experienced data scientists, software engineers, and educators. All content is reviewed by industry professionals to ensure accuracy and relevance.

Last reviewed: 2026-10-14

—
☆☆☆☆☆
0 ratings

Rate & Feedback

Need Expert GCP Data Engineering Help?

Get personalized tutoring, project support, or professional consulting.

Advertisement