Tag
Tables & Views Snowflake Docs - CREATE TAG
Snowflake Docs - ALTER TAG
Usage
- Used to create and manage tags within a schema
- All objects must live inside a [DATABASE]/[SCHEMA]/TAGS folder
- Tag name = name of the yml config file within [DATABASE]/[SCHEMA]/TAGS folder
Snowflake Attributes
Parameter |
Description |
|---|---|
COMMENT |
(String) - Optional |
OWNER |
(String) - Optional
|
ALLOWED_VALUES |
(List[string]) - Optional |
MASKING_POLICIES |
(List[string]) - Optional |
GRANTS |
({KEY:VALUE}) - Optional |
Optional Parameter Defaults - if omitted, Snowflake defaults for parameters are used, just like creating an object manually.
Deployment attributes
Parameter |
Description |
|---|---|
DEPLOY_ENV |
(List) - Optional
|
DEPLOY_LOCK |
(Bool) - Optional
|
Folder Structure
snowflake/data/[database name]/[schema name]/TAGS/[tag name].yml
Example Structure
snowflake/data/CONTROL/GOVERNANACE/TAGS/SENSITIVITY.yml
snowflake/data/CONTROL/GOVERNANACE/TAGS/SEMANTIC.yml
This specifies the metadata for 2 tags named "SENSITIVITY" and "SEMANTIC" within the CONTROL.GOVERNANCE schema, each with their own yml config file based on the tag name
Samples
Basic
COMMENT: This is the comment telling what this is all about
OWNER: INSTANCEADMIN
ALLOWED_VALUES:
- NEW
- PUBLIC
- INTERNAL
- CONFIDENTIAL
- RESTRICTED
MASKING_POLICIES:
- {{ref('CONTROL__GOVERNANCE__SEMANTIC')}}
With a deploy lock & restricted deployment environments.
COMMENT: This is the comment telling what this is all about
OWNER: INSTANCEADMIN
ALLOWED_VALUES:
- NEW
- PUBLIC
- INTERNAL
- CONFIDENTIAL
- RESTRICTED
MASKING_POLICIES:
- {{ref('CONTROL__GOVERNANCE__SEMANTIC')}}
DEPLOY_LOCK: true
DEPLOY_ENV:
- PROD
- TEST
Reference in other config
Other objects may need to reference this object and can do so using jinja references.
Reference Structure: {{ref('[database name][schema name][tag name]')}}
Example - reference the tag named SENSITIVITY in the CONTROL.GOVERNANCE schema:
TAGS:
- {{ref('CONTROL__GOVERNANCE__SENSITIVITY')}}: HR