Untitled

mail@pastecode.io avatar
unknown
plain_text
25 days ago
950 B
0
Indexable
Never
from google.cloud import datacatalog_v1

project_id = "scrapick-dev"

# Tag template to create.
tag_template_id = "test_nj"

location = "us-central1"
datacatalog_client = datacatalog_v1.DataCatalogClient()

tag_template = datacatalog_v1.types.TagTemplate()

tag_template.display_name = "Demo Tag Template"

tag_template.fields["source"] = datacatalog_v1.types.TagTemplateField()
tag_template.fields["source"].display_name = "Source of data asset"
tag_template.fields[
    "source"
].type_.primitive_type = datacatalog_v1.types.FieldType.PrimitiveType.STRING

expected_template_name = datacatalog_v1.DataCatalogClient.tag_template_path(
        project_id, location, tag_template_id
    )
tag_template = datacatalog_client.create_tag_template(
    parent=f"projects/{project_id}/locations/{location}",
    tag_template_id=tag_template_id,
    tag_template=tag_template,
)
print(f"Created template: {tag_template.name}")

Leave a Comment