Object
Tables & Views Snowflake Docs - ALTER TABLE
Snowflake Docs - ALTER VIEW
Usage
- Tables and views are grouped simply into "objects" as these can sometimes be interchangeable depending on the environment, or materialization.
- Currently only supported the meta data of an object, not the creation the object.
- The primary use case currently is for managing metadata such as tags and grants on objects created with other applications or via Snowflake procedures/scripts.
- All objects must live inside a [DATABASE]/[SCHEMA]/OBJECTS folder
- Object name = name of the yml config file within [DATABASE]/[SCHEMA]/OBJECTS folder
Snowflake Attributes
Parameter |
Description |
|---|---|
RETENTION_TIME_IN_DAYS |
(Int) - Optional |
OBJECT_TYPE |
(String) - Optional |
COMMENT |
(String) - Optional |
OWNER |
(String) - Optional
|
CHANGE_TRACKING |
(Bool) - Optional |
ROW_ACCESS_POLICY |
(dict) - Optional (see below for structure) |
COLUMNS |
(COLUMN) - Optional |
TAGS |
({KEY:VALUE}) - Optional |
GRANTS |
({KEY:VALUE}) - Optional |
ROW_ACCESS_POLICY
Parameter |
Description |
|---|---|
NAME |
(String) - Optional
|
INPUT_COLUMNS |
(LIST) - Optional
|
Optional Parameter Defaults - if omitted, Snowflake defaults for parameters are used, just like creating an object manually.
COLUMN
Parameter |
Description |
|---|---|
NAME |
(String) - Optional |
TAGS |
({KEY:VALUE}) - Optional |
Used within the list of Columns to tag specific columns
Deployment attributes
Parameter |
Description |
|---|---|
DEPLOY_ENV |
(List) - Optional
|
DEPLOY_LOCK |
(Bool) - Optional
|
Folder Structure
snowflake/data/[database name]/[schema name]/OBJECTS/[object name].yml
Example Structure
snowflake/data/MY_DATABASE1/HR/OBJECTS/PEOPLE.yml
snowflake/data/MY_DATABASE1/HR/OBJECTS/DEPARTMENT.yml
This specifies the metadata for 2 objects named "PEOPLE" and "DEPARTMENT" within the MY_DATABASE1.HR schema, each with their own yml config file based on the object name
Samples
Basic
COMMENT: This is the comment telling what this is all about
OWNER: INSTANCEADMIN
DATA_RETENTION_TIME_IN_DAYS: 1
CHANGE_TRACKING: true
COLUMNS:
- name: ID
tags:
- {{ref('CONTROL__GOVERNANCE__SENSITIVITY')}}: INTERNAL
- {{ref('CONTROL__GOVERNANCE__SEMANTIC')}}: IDENTIFIER
- name: FIRST_NAME
tags:
- {{ref('CONTROL__GOVERNANCE__SENSITIVITY')}}: CONFIDENTIAL
- {{ref('CONTROL__GOVERNANCE__SEMANTIC')}}: NAME
TAGS:
- {{ref('CONTROL__GOVERNANCE__DOMAIN')}}: HR
GRANTS:
- {{role('SOME_ROLE')}}: SELECT, INSERT
With a deploy lock & restricted deployment environments.
COMMENT: This is the comment telling what this is all about
OWNER: INSTANCEADMIN
DATA_RETENTION_TIME_IN_DAYS: 1
CHANGE_TRACKING: true
COLUMNS:
- NAME: ID
TAGS:
- {{ref('CONTROL__GOVERNANCE__SENSITIVITY')}}: INTERNAL
- {{ref('CONTROL__GOVERNANCE__SEMANTIC')}}: IDENTIFIER
- NAME: FIRST_NAME
TAGS:
- {{ref('CONTROL__GOVERNANCE__SENSITIVITY')}}: CONFIDENTIAL
- {{ref('CONTROL__GOVERNANCE__SEMANTIC')}}: NAME
TAGS:
- {{ref('CONTROL__GOVERNANCE__DOMAIN')}}: HR
GRANTS:
- {{role('SOME_ROLE')}}: SELECT, INSERT
DEPLOY_LOCK: true
DEPLOY_ENV:
- PROD
- TEST