Skip to content

Client to manage tags using the GCP data_catalog client

Notifications You must be signed in to change notification settings

mastats/gcp-data-catalog-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

gcp-data-catalog-client

Usage

  • Add & update BigQuery tables metadata. E.g. A task in an Airflow ETL DAG to add metadata about data ingestion or governance.
  • Retrieve tags assigned to different tables and use metadata to build a report

Basic usage

  1. Add a Tag instance to a BigQuery table using an existing Tag Template
  2. Update a table Tag instance. E.g. add more fields or delete existing ones
  3. Get Tags fields assigned to a table for a specific Tag Template

Example

from tag_client import TagClient

# TagClient init
tag_client = TagClient(
    project_id="project-id",
    dataset_id="dataset-id",
    table_id="table-id",
    location="tag-template-location",
    tag_template_id="tag-template-id",
    key_path="/path/to/key/file.json"
)

# Create a Tag instance for the selected table & Tag template
tag_instance = tag_client.create_tag_instance({
    "data_ingestion_owner": "John Doe",
    "rows_processed": 123,
    "pii": False,
    "final_report_name": sales_market_01
})

# Update table existing Tag instance fields
updated_tag_instance = tag_client.update_tag_instance({
    "field1": "new-value",
    "field2": 456
})

About

Client to manage tags using the GCP data_catalog client

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages