What You'll Learn
- 1Explain what problem a catalog solves that a folder of table names does not
- 2Structure a Dataplex lake and zone so auto-discovery brings the right assets into the catalog
- 3Define tag templates that make classification, ownership, and SLAs queryable
- 4Record lineage for a pipeline and use it for impact analysis before a change ships
Nobody has ever found the right dataset by reading bucket listings, and the cost of missing metadata shows up as duplicated pipelines and dashboards that disagree by three percent. Google's answer has been Data Catalog, a searchable metadata service for BigQuery, Cloud Storage, and Bigtable, and Dataplex, the governance layer that discovers assets, scans them for quality and sensitive data, and now houses the catalog itself as Dataplex Universal Catalog. This lesson covers the object model, the tagging workflow that makes policy enforceable, and the lineage records that tell you what breaks when you change a table.
What a catalog has to answer
Three questions drive every catalog design: what exists, who owns it, and can I trust it. Table names answer none of them. A useful entry carries technical metadata that discovery imports automatically, business metadata that humans supply through tags and glossary terms, and operational metadata such as freshness, quality scores, and the job that last wrote it.
The trick is to keep the two kinds apart. Technical metadata should never be typed by hand, because it drifts the moment someone renames a column, so let Dataplex assets pull it from the source on a schedule. Business metadata should never be inferred, because a model guessing that a column named ssn holds national identifiers is a compliance story nobody wants to defend. Tags are where the two meet, and a tag template is the schema that keeps them consistent.
Dataplex lakes, zones, and auto-discovery
Dataplex organises storage into a lake, which is a governance boundary, and zones inside it, conventionally one for raw data and one for curated data. Assets attach a BigQuery dataset, a Cloud Storage bucket, or a Bigtable instance to a zone, and discovery then imports the structure of whatever the asset points at, keeping the catalog in step without a sync script.
from google.cloud import dataplex_v1
client = dataplex_v1.DataplexServiceClient()
lake = client.create_lake(
request={
'parent': 'projects/my-project/locations/us-central1',
'lake_id': 'analytics-lake',
'lake': {'display_name': 'Analytics Lake', 'description': 'Governed analytics storage'},
}
)
zone = client.create_zone(
request={
'parent': lake.name,
'zone_id': 'curated',
'zone': {
'display_name': 'Curated',
'type_': dataplex_v1.Zone.Type.CURATED,
'resource_location_type': dataplex_v1.Zone.ResourceLocationType.SINGLE_REGION,
},
}
)
print(zone.name)
The boundary you draw decides who can do what: access policies attach to the lake and the zone, so putting a regulated dataset in the wrong zone silently weakens the controls around it. Treat zone membership as a classification decision rather than a storage decision, and review it the same way you review group membership. Teams that get this right use two zones only, raw and curated, and move data between them with a job that runs quality checks, so that membership in a zone always implies a level of trust.
Tag templates are the schema of your metadata
A tag template defines fields, their types, and their allowed values, which is what turns a comment into something you can search, filter, and enforce. Create one template per policy concern rather than one giant template, because a template with forty fields is one nobody fills in.
from google.cloud import datacatalog_v1
client = datacatalog_v1.DataCatalogClient()
template = client.create_tag_template(
request={
'parent': 'projects/my-project/locations/us-central1',
'tag_template_id': 'pii_classification',
'tag_template': {
'display_name': 'PII Classification',
'fields': {
'pii_type': {
'display_name': 'PII Type',
'type': {'enum_type': {'allowed_values': [
{'display_name': 'None'}, {'display_name': 'Email'},
{'display_name': 'Phone'}, {'display_name': 'SSN'},
{'display_name': 'Credit Card'},
]}},
},
'data_owner': {'display_name': 'Data Owner', 'type': {'primitive_type': 'STRING'}},
'sla_hours': {'display_name': 'SLA (hours)', 'type': {'primitive_type': 'DOUBLE'}},
},
},
}
)
client.create_tag(
request={
'parent': (
'projects/my-project/locations/us-central1/entryGroups/@bigquery/'
'entries/project~my-project~datasets~analytics~tables~users'
),
'tag': {
'template': template.name,
'fields': {
'pii_type': {'enum_value': {'display_name': 'Email'}},
'data_owner': {'string_value': '[email protected]'},
'sla_hours': {'double_value': 24.0},
},
},
}
)
Attach column level tags where the risk lives, since a table that is safe overall can hold one column that is not. Policy tags attached to columns drive BigQuery column level access control and DLP inspection, so a tag is not documentation, it is a control with an audit trail behind it. The practical consequence is that classification must happen before the data is exposed: a sensitive column published without a tag will be read by anyone with dataset level access until somebody notices, and the notice usually comes from an auditor rather than an engineer.
Lineage records what the pipeline did
Lineage answers the question that precedes every migration: if I change this table, what else moves. The Dataplex Lineage API takes events that describe a run of a pipeline, naming the source, the target, and the window of time, and the catalog stitches them into a graph you can query.
from google.cloud import dataplex_v1
client = dataplex_v1.LineageClient()
client.create_lineage_event(
request={
'parent': 'projects/my-project/locations/us-central1',
'lineage_event': {
'run': {
'pipeline': {'name': 'sales-etl-pipeline'},
'start_time': '2025-01-15T10:00:00Z',
'end_time': '2025-01-15T10:05:00Z',
},
'source': {
'name': 'gs://my-data-lake/bronze/sales/',
'type_': dataplex_v1.LineageEvent.Source.Type.STORAGE_BUCKET,
},
'target': {
'name': 'projects/my-project/datasets/analytics/tables/sales',
'type_': dataplex_v1.LineageEvent.Target.Type.BIGQUERY_TABLE,
},
},
}
)
Emit the event from the same job that writes the data, not from a nightly reconciliation, because a lineage graph that lags by a day is worse than none: it is authoritative and wrong. With events flowing, impact analysis becomes a query instead of a conversation, and an engineer proposing to drop a column can list the dashboards, models, and pipelines that would break. The same graph settles the recurring argument about which dashboard is the source of truth, because the edge from a table to a report either exists or it does not.
Search, and the SQL that supports governance
Discovery is only useful if people can find things, and the search index covers entry names, descriptions, tag values, and column names. Ask for the same three facts you would ask a colleague: the term, the owner, and the freshness. The catalog's own metadata is also queryable from BigQuery, which lets you report on coverage instead of guessing.
SELECT
table_schema,
table_name,
column_name,
policy_tags
FROM `region-us`.INFORMATION_SCHEMA.COLUMN_FIELD_PATHS
WHERE ARRAY_LENGTH(policy_tags) = 0
AND table_schema = 'analytics'
ORDER BY table_name;
Reports like that one turn governance into a number you can improve: percentage of tables with an owner, percentage of sensitive columns under policy tag, percentage of curated tables with a quality scan attached. Review them monthly with the same seriousness as an uptime report, because an unowned dataset discovered during an incident is a governance failure, not bad luck. Coverage also gives you a backlog in priority order, since the columns missing policy tags in a finance dataset outrank the ones missing tags in scratch space.
Choosing the tool for the job
The GCP metadata surface has several overlapping pieces, and interviews often hinge on knowing which one owns what.
| Concern | Tool | What it holds | Who maintains it |
|---|---|---|---|
| Discovery and search | Dataplex Universal Catalog (successor to Data Catalog) | Entries, tags, glossary terms | Discovery plus stewards |
| Data quality | Dataplex data scans | Rules, scores, freshness checks | Data engineers |
| Column policy | Policy tags | Classification that drives access | Security and stewards |
| Table statistics | BigQuery INFORMATION_SCHEMA | Partitions, bytes, column stats | Automatic |
| Pipeline lineage | Dataplex Lineage API | Source to target edges per run | Pipeline code |
Google has been consolidating Data Catalog into Dataplex Universal Catalog, so verify which API surface your project is on before you write new integrations. The concepts in this lesson carry over either way, because the entry, the tag template, and the lineage edge have kept their shape through the rename, and a team that understands those three objects can move between the versions without relearning the model.
Common Mistakes
Letting engineers tag tables during a one-off cleanup and never refreshing them
Fix: Attach tagging to the pipeline that creates the table so classification lands on day one and discovery only has to verify it.
Recording lineage from a nightly reconciliation job
Fix: Emit lineage events inside the pipeline run itself, so the graph reflects what happened rather than what the auditor hopes happened.
Building a single tag template with every field anyone ever asked for
Fix: Split templates by concern, such as PII, ownership, and SLA, so each one stays short enough that people actually fill it in.
Best Practices
- Put ownership and SLA tags on curated tables as a release gate, not as a cleanup task
- Attach policy tags at column level and let BigQuery enforce them instead of relying on review
- Report tag coverage and quality scan results monthly alongside reliability metrics
Key Takeaways
- Discovery imports technical metadata, humans supply business metadata, and tags are the only place the two meet
- A Dataplex zone is a classification boundary: lake and zone policies decide who can reach the assets inside
- Tag templates define enums and types so classification is searchable, enforceable, and auditable
- Lineage emitted from inside the pipeline turns impact analysis into a query instead of a meeting
Interview Questions
Q1: What is the purpose of Data Catalog and Dataplex Universal Catalog?
It is the searchable index of your data estate: entries for every BigQuery table, GCS bucket, and Bigtable instance, enriched with tags and glossary terms, so a user can find an asset, see who owns it, and judge whether it can be trusted without asking around.
Q2: How does Dataplex relate to the catalog?
Dataplex provides the governance container: lakes and zones that group assets, auto-discovery that imports their structure, data scans that score quality and find sensitive columns, and glossary terms for business language. Dataplex Universal Catalog is where that metadata is now served and searched.
Q3: What are tag templates used for?
They define the schema of business metadata, with typed fields and allowed enum values, which makes classification searchable and consistent. Attached at column level, tags become controls that BigQuery and DLP enforce rather than documentation that drifts.
Q4: How do you implement data lineage on GCP?
Emit events through the Dataplex Lineage API from inside each pipeline, naming the source, the target, and the run window, then read the graph for impact analysis. The important design rule is that lineage is written by the job that moved the data.
Q5: How do you measure whether a catalog is working?
Track coverage: share of curated tables with an owner tag, share of sensitive columns under policy tag, share of curated assets with a quality scan, and how often search leads to a successful query. Coverage that never moves means tagging is treated as cleanup instead of delivery.