Skip to main content

Snowflake Schema

aggregation_policy​

The aggregation_policy block describes a Snowflake aggregation policy in a database schema.

aggregation_policy "min_group" {
schema = schema.public
as = "AGGREGATION_CONSTRAINT(MIN_GROUP_SIZE => 11)"
}

aggregation_policy attributes​

NameRequiredValue
astruestring
commentfalsestring
depends_onfalse

List of object references

schematrue

Object reference to schema

aggregation_policy blocks​

aggregation_policy.tag​

The tag block describes the association of a Snowflake tag with a supported object (e.g., table, view, column, etc.).

table "USERS" {
schema = schema.SALES
retention_time = 1
column "CUSTOMER_ID" {
null = true
type = NUMBER(38)
}
column "EMAIL" {
null = true
type = VARCHAR(16777216)
}
tag {
ref = tag.DATA_DOMAIN
value = "customer_management"
}
}
aggregation_policy.tag attributes​
NameRequiredValue
reftrue

Tag reference can be one of:

  1. Object reference to tag
  2. string
valuetruestring
aggregation_policy.tag constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue

aggregation_policy constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., aggregation_policy "name" )true
Allow Qualifier (e.g., aggregation_policy "schema" "name" )true

alert​

The alert block describes a Snowflake alert in a database schema.

alert "failed_jobs" {
schema = schema.public
schedule = "USING CRON 0 9 * * * UTC"
warehouse = "my_wh"
condition = "SELECT 1 FROM jobs WHERE status = 'failed'"
action = "CALL notify_ops()"
comment = "Alert on failed jobs"
}

alert attributes​

NameRequiredValue
actiontruestring
commentfalsestring
conditiontruestring
schedulefalsestring
schematrue

Object reference to schema

suspend_alert_after_num_failuresfalseint
warehousefalse

Warehouse name or reference can be one of:

  1. Object reference to warehouse
  2. string

alert blocks​

alert.tag​

The tag block describes the association of a Snowflake tag with a supported object (e.g., table, view, column, etc.).

table "USERS" {
schema = schema.SALES
retention_time = 1
column "CUSTOMER_ID" {
null = true
type = NUMBER(38)
}
column "EMAIL" {
null = true
type = VARCHAR(16777216)
}
tag {
ref = tag.DATA_DOMAIN
value = "customer_management"
}
}
alert.tag attributes​
NameRequiredValue
reftrue

Tag reference can be one of:

  1. Object reference to tag
  2. string
valuetruestring
alert.tag constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue

alert constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., alert "name" )true
Allow Qualifier (e.g., alert "schema" "name" )true

database_role​

database_role attributes​

NameRequiredValue
commentfalsestring
databasefalsestring
member_offalse

List of object reference to database_role

database_role constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., database_role "name" )true

dynamic_table​

The dynamic block describes a dynamic table in a database schema.

dynamic_table "users" {
schema = schema.public
column "id" {
comment = "User ID"
}
target_lag = DOWNSTREAM // or "<num> { seconds | minutes | hours | days }"
refresh_mode = INCREMENTAL | FULL
initialize = ON_CREATE | ON_SCHEDULE
as = "SELECT * FROM users"
...
}

dynamic_table attributes​

NameRequiredValue
astruestring
cluster_byfalse

List of strings

commentfalsestring
depends_onfalse

List of object references

initializefalse

Dynamic table initialize mode can be one of:

  1. string
  2. enum (ON_CREATE, ON_SCHEDULE)
max_data_extension_timefalseint
refresh_modefalse

Dynamic table refresh mode can be one of:

  1. string
  2. enum (INCREMENTAL, FULL, AUTO)
retention_timefalseint
schematrue

Object reference to schema

target_lagtrue

Dynamic table target lag can be one of:

  1. string
  2. enum (DOWNSTREAM)
transientfalsebool
warehousefalsestring

dynamic_table blocks​

dynamic_table.column​

dynamic_table.column attributes​
NameRequiredValue
commentfalsestring
nullfalsebool
typefalse

Column type can be one of:

  1. Schema type
  2. Raw expression defined with sql("expr")
dynamic_table.column blocks​

dynamic_table.column.annotation​

dynamic_table.column.annotation constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Allow unknown blockstrue
Allow unknown attributestrue

dynamic_table.column.policy.masking​

dynamic_table.column.policy.masking attributes​
NameRequiredValue
reftrue

Policy reference can be one of:

  1. Object reference to masking_policy
  2. string
usingfalse

List of strings

dynamic_table.column.policy.masking constraints​
ConstraintValue
Requiredfalse
Repeatabletrue

dynamic_table.column.policy.projection​

dynamic_table.column.policy.projection attributes​
NameRequiredValue
reftrue

Policy reference can be one of:

  1. Object reference to projection_policy
  2. string
dynamic_table.column.policy.projection constraints​
ConstraintValue
Requiredfalse
Repeatabletrue

dynamic_table.column.tag​

The tag block describes the association of a Snowflake tag with a supported object (e.g., table, view, column, etc.).

table "USERS" {
schema = schema.SALES
retention_time = 1
column "CUSTOMER_ID" {
null = true
type = NUMBER(38)
}
column "EMAIL" {
null = true
type = VARCHAR(16777216)
}
tag {
ref = tag.DATA_DOMAIN
value = "customer_management"
}
}
dynamic_table.column.tag attributes​
NameRequiredValue
reftrue

Tag reference can be one of:

  1. Object reference to tag
  2. string
valuetruestring
dynamic_table.column.tag constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue
dynamic_table.column constraints​
ConstraintValue
Requiredfalse
Require Name (e.g., dynamic_table.column "name" )true

dynamic_table.policy.aggregation​

dynamic_table.policy.aggregation attributes​
NameRequiredValue
entity_keyfalse

List of strings

reftrue

Policy reference can be one of:

  1. Object reference to aggregation_policy
  2. string
dynamic_table.policy.aggregation constraints​
ConstraintValue
Requiredfalse
Repeatabletrue

dynamic_table.policy.join​

dynamic_table.policy.join attributes​
NameRequiredValue
reftrue

Policy reference can be one of:

  1. Object reference to join_policy
  2. string
dynamic_table.policy.join constraints​
ConstraintValue
Requiredfalse
Repeatabletrue

dynamic_table.policy.row_access​

dynamic_table.policy.row_access attributes​
NameRequiredValue
columnstrue

List of strings

reftrue

Policy reference can be one of:

  1. Object reference to row_access_policy
  2. string
dynamic_table.policy.row_access constraints​
ConstraintValue
Requiredfalse
Repeatabletrue

dynamic_table.tag​

The tag block describes the association of a Snowflake tag with a supported object (e.g., table, view, column, etc.).

table "USERS" {
schema = schema.SALES
retention_time = 1
column "CUSTOMER_ID" {
null = true
type = NUMBER(38)
}
column "EMAIL" {
null = true
type = VARCHAR(16777216)
}
tag {
ref = tag.DATA_DOMAIN
value = "customer_management"
}
}
dynamic_table.tag attributes​
NameRequiredValue
reftrue

Tag reference can be one of:

  1. Object reference to tag
  2. string
valuetruestring
dynamic_table.tag constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue

dynamic_table constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., dynamic_table "name" )true
Allow Qualifier (e.g., dynamic_table "schema" "name" )true

external_access_integration​

The external_access_integration block describes a Snowflake external access integration, an account-level object.

external_access_integration "gateway" {
allowed_network_rules = [network_rule.egress_api]
allowed_authentication_secrets = [secret.api_token] // or ALL
comment = "outbound gateway"
}

Only HOST_PORT egress network rules may be listed, and at least one is required. enabled defaults to true.

external_access_integration attributes​

NameRequiredValue
allow_all_authentication_secretsfalsebool
allowed_api_authentication_integrationsfalse

List of strings

allowed_authentication_secretsfalse

List of values, where each can be one of:

  1. Object reference to secret
  2. string
allowed_network_rulestrue

List of values, where each can be one of:

  1. Object reference to network_rule
  2. string
commentfalsestring
enabledfalsebool

external_access_integration blocks​

external_access_integration.tag​

The tag block describes the association of a Snowflake tag with a supported object (e.g., table, view, column, etc.).

table "USERS" {
schema = schema.SALES
retention_time = 1
column "CUSTOMER_ID" {
null = true
type = NUMBER(38)
}
column "EMAIL" {
null = true
type = VARCHAR(16777216)
}
tag {
ref = tag.DATA_DOMAIN
value = "customer_management"
}
}
external_access_integration.tag attributes​
NameRequiredValue
reftrue

Tag reference can be one of:

  1. Object reference to tag
  2. string
valuetruestring
external_access_integration.tag constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue

external_access_integration constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., external_access_integration "name" )true
Mutually exclusive sets[allowed_authentication_secrets, allow_all_authentication_secrets]

external_table​

The external_table block describes an external table in a database schema.

external_table "events" {
schema = schema.public
column "event_id" {
type = VARCHAR(255)
as {
expr = "value:c1::varchar"
}
}
location {
stage = stage.mystage
path = "data/events/"
}
}

external_table attributes​

NameRequiredValue
auto_refreshfalsebool
commentfalsestring
depends_onfalse

List of object references

file_formatfalse

File format options or reference can be one of:

  1. Object reference to file_format
  2. map
partition_byfalse

List of strings

patternfalsestring
refresh_on_createfalsebool
retention_timefalseint
schematrue

Object reference to schema

external_table blocks​

external_table.column​

external_table.column attributes​
NameRequiredValue
asfalsestring
commentfalsestring
nullfalsebool
typetrue

Column type can be one of:

  1. Schema type
  2. Raw expression defined with sql("expr")
external_table.column blocks​

external_table.column.annotation​

external_table.column.annotation constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Allow unknown blockstrue
Allow unknown attributestrue

external_table.column.policy.masking​

external_table.column.policy.masking attributes​
NameRequiredValue
reftrue

Policy reference can be one of:

  1. Object reference to masking_policy
  2. string
usingfalse

List of strings

external_table.column.policy.masking constraints​
ConstraintValue
Requiredfalse
Repeatabletrue

external_table.column.tag​

The tag block describes the association of a Snowflake tag with a supported object (e.g., table, view, column, etc.).

table "USERS" {
schema = schema.SALES
retention_time = 1
column "CUSTOMER_ID" {
null = true
type = NUMBER(38)
}
column "EMAIL" {
null = true
type = VARCHAR(16777216)
}
tag {
ref = tag.DATA_DOMAIN
value = "customer_management"
}
}
external_table.column.tag attributes​
NameRequiredValue
reftrue

Tag reference can be one of:

  1. Object reference to tag
  2. string
valuetruestring
external_table.column.tag constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue
external_table.column constraints​
ConstraintValue
Requiredfalse
Require Name (e.g., external_table.column "name" )true

external_table.foreign_key​

external_table.foreign_key attributes​
NameRequiredValue
columnstrue

Foreign key columns can be one of:

  1. List of object reference to column
  2. List of object reference to external_table.column
commentfalsestring
ref_columnstrue

Foreign key reference columns can be one of:

  1. List of object reference to column
  2. List of object reference to external_table.column
external_table.foreign_key constraints​
ConstraintValue
Requiredfalse
Require Name (e.g., external_table.foreign_key "name" )true

external_table.location​

external_table.location attributes​
NameRequiredValue
pathfalsestring
stagetrue

Object reference to stage

external_table.location constraints​
ConstraintValue
Requiredtrue
Require Namefalse

external_table.policy.join​

external_table.policy.join attributes​
NameRequiredValue
reftrue

Policy reference can be one of:

  1. Object reference to join_policy
  2. string
external_table.policy.join constraints​
ConstraintValue
Requiredfalse
Repeatabletrue

external_table.policy.row_access​

external_table.policy.row_access attributes​
NameRequiredValue
columnstrue

List of strings

reftrue

Policy reference can be one of:

  1. Object reference to row_access_policy
  2. string
external_table.policy.row_access constraints​
ConstraintValue
Requiredfalse
Repeatabletrue

external_table.primary_key​

external_table.primary_key attributes​
NameRequiredValue
columnstrue

Index columns can be one of:

  1. List of object reference to column
  2. List of object reference to external_table.column
commentfalsestring

external_table.tag​

The tag block describes the association of a Snowflake tag with a supported object (e.g., table, view, column, etc.).

table "USERS" {
schema = schema.SALES
retention_time = 1
column "CUSTOMER_ID" {
null = true
type = NUMBER(38)
}
column "EMAIL" {
null = true
type = VARCHAR(16777216)
}
tag {
ref = tag.DATA_DOMAIN
value = "customer_management"
}
}
external_table.tag attributes​
NameRequiredValue
reftrue

Tag reference can be one of:

  1. Object reference to tag
  2. string
valuetruestring
external_table.tag constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue

external_table.unique​

external_table.unique attributes​
NameRequiredValue
columnstrue

Index columns can be one of:

  1. List of object reference to column
  2. List of object reference to external_table.column
commentfalsestring
external_table.unique constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Mutually exclusive sets[columns, on]
One of required sets[columns, on]

external_table constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., external_table "name" )true
Allow Qualifier (e.g., external_table "schema" "name" )true

external_volume​

The external_volume block describes a Snowflake external volume for Iceberg tables.

external_volume "my_vol" {
allow_writes = true
comment = "My external volume"
storage_location "S3" "my-s3-location" {
storage_base_url = "s3://my-bucket/path/"
storage_aws_role_arn = "arn:aws:iam::123456789012:role/myrole"
encryption {
type = "AWS_SSE_KMS"
kms_key_id = "1234abcd-12ab-34cd-56ef-1234567890ab"
}
}
}

external_volume attributes​

NameRequiredValue
allow_writesfalsebool
commentfalsestring

external_volume blocks​

external_volume.storage_location.AZURE​

external_volume.storage_location.AZURE attributes​
NameRequiredValue
azure_tenant_idtruestring
storage_base_urltruestring
external_volume.storage_location.AZURE constraints​
ConstraintValue
Requiredfalse
Repeatabletrue

external_volume.storage_location.GCS​

external_volume.storage_location.GCS attributes​
NameRequiredValue
storage_base_urltruestring
external_volume.storage_location.GCS blocks​

external_volume.storage_location.encryption​

external_volume.storage_location.encryption attributes​
NameRequiredValue
kms_key_idfalsestring
typefalsestring
external_volume.storage_location.GCS constraints​
ConstraintValue
Requiredfalse
Repeatabletrue

external_volume.storage_location.S3​

external_volume.storage_location.S3 attributes​
NameRequiredValue
storage_aws_access_point_arnfalsestring
storage_aws_external_idfalsestring
storage_aws_role_arntruestring
storage_base_urltruestring
external_volume.storage_location.S3 blocks​

external_volume.storage_location.encryption​

external_volume.storage_location.encryption attributes​
NameRequiredValue
kms_key_idfalsestring
typefalsestring
external_volume.storage_location.S3 constraints​
ConstraintValue
Requiredfalse
Repeatabletrue

external_volume.storage_location.S3COMPAT​

external_volume.storage_location.S3COMPAT attributes​
NameRequiredValue
storage_base_urltruestring
storage_endpointtruestring
external_volume.storage_location.S3COMPAT constraints​
ConstraintValue
Requiredfalse
Repeatabletrue

external_volume.storage_location.S3GOV​

external_volume.storage_location.S3GOV attributes​
NameRequiredValue
storage_aws_access_point_arnfalsestring
storage_aws_external_idfalsestring
storage_aws_role_arntruestring
storage_base_urltruestring
external_volume.storage_location.S3GOV blocks​

external_volume.storage_location.encryption​

external_volume.storage_location.encryption attributes​
NameRequiredValue
kms_key_idfalsestring
typefalsestring
external_volume.storage_location.S3GOV constraints​
ConstraintValue
Requiredfalse
Repeatabletrue

external_volume constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., external_volume "name" )true

file_format​

The file_format block describes a named Snowflake file format in a database schema.

file_format "my_csv_format" {
schema = schema.public
comment = "My CSV file format"
type = CSV
options = {
BINARY_AS_TEXT = false
COMPRESSION = GZIP
FIELD_DELIMITER = "|"
SKIP_HEADER = 1
}
}

file_format attributes​

NameRequiredValue
commentfalsestring
optionsfalsemap
schematrue

Object reference to schema

typetrue

enum (AVRO, CSV, JSON, ORC, PARQUET, XML)

file_format constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., file_format "name" )true
Allow Qualifier (e.g., file_format "schema" "name" )true

function​

The function block describes a function in a database schema.

function "positive" {
schema = schema.public
lang = SQL
arg "v" {
type = integer
}
...
}

function attributes​

NameRequiredValue
asfalsestring
commentfalsestring
depends_onfalse

List of object references

execute_asfalse

enum (OWNER, CALLER)

external_access_integrationsfalse

List of strings

handlerfalsestring
immutablefalsebool
langfalse

enum (SQL, JAVASCRIPT, PYTHON, JAVA, SCALA)

null_callfalse

enum (CALLED, RETURNS_NULL)

packagesfalse

List of strings

returnfalse

Return type can be one of:

  1. Schema type
  2. Raw expression defined with sql("expr")
runtime_versionfalsestring
schematrue

Object reference to schema

securefalsebool

function blocks​

function.annotation​

function.annotation constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Allow unknown blockstrue
Allow unknown attributestrue

function.arg​

function.arg attributes​
NameRequiredValue
defaultfalse

Argument default value can be one of:

  1. number
  2. string
  3. bool
  4. Raw expression defined with sql("expr")
typetrue

Argument type can be one of:

  1. Schema type
  2. Raw expression defined with sql("expr")
function.arg constraints​
ConstraintValue
Requiredfalse
Require Name (e.g., function.arg "name" )true

function.imports​

function.imports attributes​
NameRequiredValue
filetruestring
stagetrue

Object reference to stage

function.imports constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue

function.return_table​

function.return_table blocks​

function.return_table.column​

function.return_table.column attributes​
NameRequiredValue
typetrue

Column type can be one of:

  1. Schema type
  2. Raw expression defined with sql("expr")
function.return_table.column blocks​

function.return_table.column.annotation​

function.return_table.column.annotation constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Allow unknown blockstrue
Allow unknown attributestrue
function.return_table.column constraints​
ConstraintValue
Requiredfalse
Require Name (e.g., function.return_table.column "name" )true

function.secrets​

function.secrets attributes​
NameRequiredValue
secrettrue

Object reference to secret

function.secrets constraints​
ConstraintValue
Requiredfalse
Require Name (e.g., function.secrets "name" )true

function.tag​

The tag block describes the association of a Snowflake tag with a supported object (e.g., table, view, column, etc.).

table "USERS" {
schema = schema.SALES
retention_time = 1
column "CUSTOMER_ID" {
null = true
type = NUMBER(38)
}
column "EMAIL" {
null = true
type = VARCHAR(16777216)
}
tag {
ref = tag.DATA_DOMAIN
value = "customer_management"
}
}
function.tag attributes​
NameRequiredValue
reftrue

Tag reference can be one of:

  1. Object reference to tag
  2. string
valuetruestring
function.tag constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue

function constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., function "name" )true
Allow Qualifier (e.g., function "schema" "name" )true
Repeatabletrue
Mutually exclusive sets[return, return_table]

hybrid_table​

The hybrid block describes a hybrid table in a database schema.

hybrid_table "users" {
schema = schema.public
column "id" {
comment = "User ID"
type = VARCHAR(255)
}
primary_key {
columns = ["id"]
}
...
}

hybrid_table attributes​

NameRequiredValue
commentfalsestring
depends_onfalse

List of object references

max_data_extension_timefalseint
retention_timefalseint
schematrue

Object reference to schema

hybrid_table blocks​

hybrid_table.column​

hybrid_table.column attributes​
NameRequiredValue
collatefalsestring
commentfalsestring
defaultfalse

Column default value can be one of:

  1. bool
  2. string
  3. number
  4. Raw expression defined with sql("expr")
nullfalsebool
typetrue

Column type can be one of:

  1. Schema type
  2. Raw expression defined with sql("expr")
hybrid_table.column blocks​

hybrid_table.column.annotation​

hybrid_table.column.annotation constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Allow unknown blockstrue
Allow unknown attributestrue

hybrid_table.column.identity​

hybrid_table.column.identity attributes​
NameRequiredValue
incrementfalseint
orderfalse

enum (ORDER, NOORDER)

startfalseint

hybrid_table.column.policy.masking​

hybrid_table.column.policy.masking attributes​
NameRequiredValue
reftrue

Policy reference can be one of:

  1. Object reference to masking_policy
  2. string
usingfalse

List of strings

hybrid_table.column.policy.masking constraints​
ConstraintValue
Requiredfalse
Repeatabletrue

hybrid_table.column.tag​

The tag block describes the association of a Snowflake tag with a supported object (e.g., table, view, column, etc.).

table "USERS" {
schema = schema.SALES
retention_time = 1
column "CUSTOMER_ID" {
null = true
type = NUMBER(38)
}
column "EMAIL" {
null = true
type = VARCHAR(16777216)
}
tag {
ref = tag.DATA_DOMAIN
value = "customer_management"
}
}
hybrid_table.column.tag attributes​
NameRequiredValue
reftrue

Tag reference can be one of:

  1. Object reference to tag
  2. string
valuetruestring
hybrid_table.column.tag constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue
hybrid_table.column constraints​
ConstraintValue
Requiredfalse
Require Name (e.g., hybrid_table.column "name" )true

hybrid_table.foreign_key​

hybrid_table.foreign_key attributes​
NameRequiredValue
columnstrue

Foreign key columns can be one of:

  1. List of object reference to column
  2. List of object reference to hybrid_table.column
commentfalsestring
ref_columnstrue

Foreign key reference columns can be one of:

  1. List of object reference to column
  2. List of object reference to hybrid_table.column
hybrid_table.foreign_key constraints​
ConstraintValue
Requiredfalse
Require Name (e.g., hybrid_table.foreign_key "name" )true

hybrid_table.policy.row_access​

hybrid_table.policy.row_access attributes​
NameRequiredValue
columnstrue

List of strings

reftrue

Policy reference can be one of:

  1. Object reference to row_access_policy
  2. string
hybrid_table.policy.row_access constraints​
ConstraintValue
Requiredfalse
Repeatabletrue

hybrid_table.primary_key​

hybrid_table.primary_key attributes​
NameRequiredValue
columnstrue

Index columns can be one of:

  1. List of object reference to column
  2. List of object reference to hybrid_table.column
commentfalsestring

hybrid_table.tag​

The tag block describes the association of a Snowflake tag with a supported object (e.g., table, view, column, etc.).

table "USERS" {
schema = schema.SALES
retention_time = 1
column "CUSTOMER_ID" {
null = true
type = NUMBER(38)
}
column "EMAIL" {
null = true
type = VARCHAR(16777216)
}
tag {
ref = tag.DATA_DOMAIN
value = "customer_management"
}
}
hybrid_table.tag attributes​
NameRequiredValue
reftrue

Tag reference can be one of:

  1. Object reference to tag
  2. string
valuetruestring
hybrid_table.tag constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue

hybrid_table.unique​

hybrid_table.unique attributes​
NameRequiredValue
columnstrue

Index columns can be one of:

  1. List of object reference to column
  2. List of object reference to hybrid_table.column
commentfalsestring
hybrid_table.unique constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Mutually exclusive sets[columns, on]
One of required sets[columns, on]

hybrid_table constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., hybrid_table "name" )true
Allow Qualifier (e.g., hybrid_table "schema" "name" )true

iceberg_table​

The iceberg_table block describes an Iceberg table in a database schema.

iceberg_table "events" {
schema = schema.public
external_volume = "my_ext_vol"
catalog = "SNOWFLAKE"
base_location = "iceberg/tables/"
column "id" {
type = NUMBER(38,0)
}
}

iceberg_table attributes​

NameRequiredValue
base_locationfalsestring
catalogtruestring
catalog_syncfalsestring
change_trackingfalsebool
cluster_byfalse

List of strings

commentfalsestring
depends_onfalse

List of object references

enable_data_compactionfalsebool
enable_iceberg_merge_on_readfalsebool
error_loggingfalsebool
external_volumetrue

External volume name or reference can be one of:

  1. Object reference to external_volume
  2. string
iceberg_versionfalseint
log_event_levelfalse

Log event level can be one of:

  1. enum (OFF, ERROR, WARN, DEBUG)
  2. string
max_data_extension_timefalseint
partition_byfalse

List of strings

path_layoutfalse

enum (FLAT, HIERARCHICAL)

replace_invalid_charactersfalsebool
retention_timefalseint
schematrue

Object reference to schema

storage_serialization_policyfalse

enum (COMPATIBLE, OPTIMIZED)

target_file_sizefalsestring
transientfalsebool

iceberg_table blocks​

iceberg_table.column​

iceberg_table.column attributes​
NameRequiredValue
commentfalsestring
defaultfalse

Column default value can be one of:

  1. bool
  2. string
  3. number
  4. Raw expression defined with sql("expr")
nullfalsebool
typetrue

Column type can be one of:

  1. Schema type
  2. Raw expression defined with sql("expr")
iceberg_table.column blocks​

iceberg_table.column.annotation​

iceberg_table.column.annotation constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Allow unknown blockstrue
Allow unknown attributestrue

iceberg_table.column.policy.masking​

iceberg_table.column.policy.masking attributes​
NameRequiredValue
reftrue

Policy reference can be one of:

  1. Object reference to masking_policy
  2. string
usingfalse

List of strings

iceberg_table.column.policy.masking constraints​
ConstraintValue
Requiredfalse
Repeatabletrue

iceberg_table.column.policy.projection​

iceberg_table.column.policy.projection attributes​
NameRequiredValue
reftrue

Policy reference can be one of:

  1. Object reference to projection_policy
  2. string
iceberg_table.column.policy.projection constraints​
ConstraintValue
Requiredfalse
Repeatabletrue

iceberg_table.column.tag​

The tag block describes the association of a Snowflake tag with a supported object (e.g., table, view, column, etc.).

table "USERS" {
schema = schema.SALES
retention_time = 1
column "CUSTOMER_ID" {
null = true
type = NUMBER(38)
}
column "EMAIL" {
null = true
type = VARCHAR(16777216)
}
tag {
ref = tag.DATA_DOMAIN
value = "customer_management"
}
}
iceberg_table.column.tag attributes​
NameRequiredValue
reftrue

Tag reference can be one of:

  1. Object reference to tag
  2. string
valuetruestring
iceberg_table.column.tag constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue
iceberg_table.column constraints​
ConstraintValue
Requiredfalse
Require Name (e.g., iceberg_table.column "name" )true

iceberg_table.foreign_key​

iceberg_table.foreign_key attributes​
NameRequiredValue
columnstrue

Foreign key columns can be one of:

  1. List of object reference to column
  2. List of object reference to iceberg_table.column
commentfalsestring
ref_columnstrue

Foreign key reference columns can be one of:

  1. List of object reference to column
  2. List of object reference to iceberg_table.column
iceberg_table.foreign_key constraints​
ConstraintValue
Requiredfalse
Require Name (e.g., iceberg_table.foreign_key "name" )true

iceberg_table.policy.aggregation​

iceberg_table.policy.aggregation attributes​
NameRequiredValue
entity_keyfalse

List of strings

reftrue

Policy reference can be one of:

  1. Object reference to aggregation_policy
  2. string
iceberg_table.policy.aggregation constraints​
ConstraintValue
Requiredfalse
Repeatabletrue

iceberg_table.policy.join​

iceberg_table.policy.join attributes​
NameRequiredValue
reftrue

Policy reference can be one of:

  1. Object reference to join_policy
  2. string
iceberg_table.policy.join constraints​
ConstraintValue
Requiredfalse
Repeatabletrue

iceberg_table.policy.row_access​

iceberg_table.policy.row_access attributes​
NameRequiredValue
columnstrue

List of strings

reftrue

Policy reference can be one of:

  1. Object reference to row_access_policy
  2. string
iceberg_table.policy.row_access constraints​
ConstraintValue
Requiredfalse
Repeatabletrue

iceberg_table.primary_key​

iceberg_table.primary_key attributes​
NameRequiredValue
columnstrue

Index columns can be one of:

  1. List of object reference to column
  2. List of object reference to iceberg_table.column
commentfalsestring

iceberg_table.tag​

The tag block describes the association of a Snowflake tag with a supported object (e.g., table, view, column, etc.).

table "USERS" {
schema = schema.SALES
retention_time = 1
column "CUSTOMER_ID" {
null = true
type = NUMBER(38)
}
column "EMAIL" {
null = true
type = VARCHAR(16777216)
}
tag {
ref = tag.DATA_DOMAIN
value = "customer_management"
}
}
iceberg_table.tag attributes​
NameRequiredValue
reftrue

Tag reference can be one of:

  1. Object reference to tag
  2. string
valuetruestring
iceberg_table.tag constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue

iceberg_table.unique​

iceberg_table.unique attributes​
NameRequiredValue
columnstrue

Index columns can be one of:

  1. List of object reference to column
  2. List of object reference to iceberg_table.column
commentfalsestring
iceberg_table.unique constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Mutually exclusive sets[columns, on]
One of required sets[columns, on]

iceberg_table constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., iceberg_table "name" )true
Allow Qualifier (e.g., iceberg_table "schema" "name" )true
Mutually exclusive sets[partition_by, cluster_by]

join_policy​

The join_policy block describes a Snowflake join policy in a database schema.

join_policy "require_join" {
schema = schema.public
as = "JOIN_CONSTRAINT(JOIN_REQUIRED => TRUE)"
}

join_policy attributes​

NameRequiredValue
astruestring
commentfalsestring
depends_onfalse

List of object references

schematrue

Object reference to schema

join_policy blocks​

join_policy.tag​

The tag block describes the association of a Snowflake tag with a supported object (e.g., table, view, column, etc.).

table "USERS" {
schema = schema.SALES
retention_time = 1
column "CUSTOMER_ID" {
null = true
type = NUMBER(38)
}
column "EMAIL" {
null = true
type = VARCHAR(16777216)
}
tag {
ref = tag.DATA_DOMAIN
value = "customer_management"
}
}
join_policy.tag attributes​
NameRequiredValue
reftrue

Tag reference can be one of:

  1. Object reference to tag
  2. string
valuetruestring
join_policy.tag constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue

join_policy constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., join_policy "name" )true
Allow Qualifier (e.g., join_policy "schema" "name" )true

masking_policy​

The masking_policy block describes a Snowflake masking policy in a database schema.

masking_policy "mask_ssn" {
schema = schema.public
arg "val" {
type = varchar
}
return = varchar
as = "CASE WHEN CURRENT_ROLE() = 'ADMIN' THEN val ELSE '***' END"
}

masking_policy attributes​

NameRequiredValue
astruestring
commentfalsestring
depends_onfalse

List of object references

exempt_other_policiesfalsebool
returntrue

Return type can be one of:

  1. Schema type
  2. Raw expression defined with sql("expr")
schematrue

Object reference to schema

masking_policy blocks​

masking_policy.arg​

masking_policy.arg attributes​
NameRequiredValue
typetrue

Argument type can be one of:

  1. Schema type
  2. Raw expression defined with sql("expr")
masking_policy.arg constraints​
ConstraintValue
Requiredfalse
Require Name (e.g., masking_policy.arg "name" )true

masking_policy.tag​

The tag block describes the association of a Snowflake tag with a supported object (e.g., table, view, column, etc.).

table "USERS" {
schema = schema.SALES
retention_time = 1
column "CUSTOMER_ID" {
null = true
type = NUMBER(38)
}
column "EMAIL" {
null = true
type = VARCHAR(16777216)
}
tag {
ref = tag.DATA_DOMAIN
value = "customer_management"
}
}
masking_policy.tag attributes​
NameRequiredValue
reftrue

Tag reference can be one of:

  1. Object reference to tag
  2. string
valuetruestring
masking_policy.tag constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue

masking_policy constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., masking_policy "name" )true
Allow Qualifier (e.g., masking_policy "schema" "name" )true

network_rule​

The network_rule block describes a Snowflake network rule in a database schema.

network_rule "allowed_ips" {
schema = schema.public
type = IPV4
mode = INGRESS
value_list = ["192.168.1.0/24", "10.0.0.1"]
comment = "office network"
}

Which modes a type accepts depends on the cloud provider hosting the account, and neither type nor mode can be altered: changing one recreates the rule.

network_rule attributes​

NameRequiredValue
commentfalsestring
modetrue

enum (INGRESS, INTERNAL_STAGE, SNOWFLAKE_MANAGED_STORAGE_VOLUME, EGRESS, DATA_CONNECTIVITY_PROXY_EGRESS, POSTGRES_INGRESS, POSTGRES_EGRESS)

schematrue

Object reference to schema

typetrue

enum (IPV4, IPV6, AWSVPCEID, AZURELINKID, GCPPSCID, HOST_PORT, PRIVATE_HOST_PORT, COMPUTE_POOL)

value_listfalse

List of strings

network_rule constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., network_rule "name" )true
Allow Qualifier (e.g., network_rule "schema" "name" )true

permission​

permission attributes​

NameRequiredValue
fortrue

Permission target resource can be one of:

  1. enum (DATABASE)
  2. Object reference to schema
  3. Object reference to table
  4. Object reference to view
  5. Object reference to dynamic_table
  6. Object reference to hybrid_table
  7. Object reference to external_table
  8. Object reference to iceberg_table
grantablefalsebool
privilegestrue

List of strings or/and enums (USAGE, MONITOR, MODIFY, CREATE_SCHEMA, CREATE_TABLE, SELECT, INSERT, UPDATE, DELETE, REFERENCES, ALL)

totrue

Permission grantee can be one of:

  1. Object reference to role
  2. Object reference to database_role

permission constraints​

ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue

pipe​

The pipe block describes a Snowflake pipe for Snowpipe data loading.

pipe "mypipe" {
schema = schema.public
as = "COPY INTO mytable FROM @mystage FILE_FORMAT = (TYPE = 'JSON')"
auto_ingest = true
comment = "My data loading pipe"
}

pipe attributes​

NameRequiredValue
astruestring
auto_ingestfalsebool
aws_sns_topicfalsestring
commentfalsestring
depends_onfalse

List of object references

error_integrationfalsestring
integrationfalsestring
schematrue

Object reference to schema

pipe blocks​

pipe.tag​

The tag block describes the association of a Snowflake tag with a supported object (e.g., table, view, column, etc.).

table "USERS" {
schema = schema.SALES
retention_time = 1
column "CUSTOMER_ID" {
null = true
type = NUMBER(38)
}
column "EMAIL" {
null = true
type = VARCHAR(16777216)
}
tag {
ref = tag.DATA_DOMAIN
value = "customer_management"
}
}
pipe.tag attributes​
NameRequiredValue
reftrue

Tag reference can be one of:

  1. Object reference to tag
  2. string
valuetruestring
pipe.tag constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue

pipe constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., pipe "name" )true
Allow Qualifier (e.g., pipe "schema" "name" )true

procedure​

The procedure block describes a procedure in a database schema.

procedure "proc" {
schema = schema.public
lang = SQL
arg "a" {
type = integer
}
...
}

procedure attributes​

NameRequiredValue
asfalsestring
commentfalsestring
depends_onfalse

List of object references

execute_asfalse

enum (OWNER, CALLER, RESTRICTED_CALLER)

external_access_integrationsfalse

List of strings

handlerfalsestring
langfalse

enum (SQL, JAVASCRIPT, PYTHON, JAVA, SCALA)

null_callfalse

enum (CALLED, RETURNS_NULL)

packagesfalse

List of strings

returnfalse

Return type can be one of:

  1. Schema type
  2. Raw expression defined with sql("expr")
runtime_versionfalsestring
schematrue

Object reference to schema

securefalsebool

procedure blocks​

procedure.annotation​

procedure.annotation constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Allow unknown blockstrue
Allow unknown attributestrue

procedure.arg​

procedure.arg attributes​
NameRequiredValue
defaultfalse

Argument default value can be one of:

  1. number
  2. string
  3. bool
  4. Raw expression defined with sql("expr")
modefalse

enum (IN, OUT)

typetrue

Argument type can be one of:

  1. Schema type
  2. Raw expression defined with sql("expr")
procedure.arg constraints​
ConstraintValue
Requiredfalse
Require Name (e.g., procedure.arg "name" )true

procedure.imports​

procedure.imports attributes​
NameRequiredValue
filetruestring
stagetrue

Object reference to stage

procedure.imports constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue

procedure.return​

procedure.return attributes​
NameRequiredValue
nullfalsebool
typetrue

Return type can be one of:

  1. Schema type
  2. Raw expression defined with sql("expr")

procedure.return_table​

procedure.return_table blocks​

procedure.return_table.column​

procedure.return_table.column attributes​
NameRequiredValue
typetrue

Column type can be one of:

  1. Schema type
  2. Raw expression defined with sql("expr")
procedure.return_table.column blocks​

procedure.return_table.column.annotation​

procedure.return_table.column.annotation constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Allow unknown blockstrue
Allow unknown attributestrue
procedure.return_table.column constraints​
ConstraintValue
Requiredfalse
Require Name (e.g., procedure.return_table.column "name" )true

procedure.secrets​

procedure.secrets attributes​
NameRequiredValue
secrettrue

Object reference to secret

procedure.secrets constraints​
ConstraintValue
Requiredfalse
Require Name (e.g., procedure.secrets "name" )true

procedure.tag​

The tag block describes the association of a Snowflake tag with a supported object (e.g., table, view, column, etc.).

table "USERS" {
schema = schema.SALES
retention_time = 1
column "CUSTOMER_ID" {
null = true
type = NUMBER(38)
}
column "EMAIL" {
null = true
type = VARCHAR(16777216)
}
tag {
ref = tag.DATA_DOMAIN
value = "customer_management"
}
}
procedure.tag attributes​
NameRequiredValue
reftrue

Tag reference can be one of:

  1. Object reference to tag
  2. string
valuetruestring
procedure.tag constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue

procedure constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., procedure "name" )true
Allow Qualifier (e.g., procedure "schema" "name" )true
Repeatabletrue
Mutually exclusive sets[return, return_table]

projection_policy​

The projection_policy block describes a Snowflake projection policy in a database schema.

projection_policy "no_project" {
schema = schema.public
as = "PROJECTION_CONSTRAINT(ALLOW => FALSE)"
}

projection_policy attributes​

NameRequiredValue
astruestring
commentfalsestring
depends_onfalse

List of object references

schematrue

Object reference to schema

projection_policy blocks​

projection_policy.tag​

The tag block describes the association of a Snowflake tag with a supported object (e.g., table, view, column, etc.).

table "USERS" {
schema = schema.SALES
retention_time = 1
column "CUSTOMER_ID" {
null = true
type = NUMBER(38)
}
column "EMAIL" {
null = true
type = VARCHAR(16777216)
}
tag {
ref = tag.DATA_DOMAIN
value = "customer_management"
}
}
projection_policy.tag attributes​
NameRequiredValue
reftrue

Tag reference can be one of:

  1. Object reference to tag
  2. string
valuetruestring
projection_policy.tag constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue

projection_policy constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., projection_policy "name" )true
Allow Qualifier (e.g., projection_policy "schema" "name" )true

resource_monitor​

The resource_monitor block describes a Snowflake resource monitor.

resource_monitor "my_rm" {
credit_quota = 1000
frequency = MONTHLY
notify_users = ["alice"]
trigger {
threshold = 100
action = SUSPEND
}
}

resource_monitor attributes​

Name and descriptionRequiredValue

credit_quota

Credits the monitor allows per interval. Dropping it clears the quota.

falsenumber

end_timestamp

When the monitor stops tracking, as an RFC3339 timestamp. Dropping it clears the end.

falsestring

frequency

How often the used-credit count resets. Snowflake takes it together with start_timestamp, so setting one emits both.

false

enum (MONTHLY, DAILY, WEEKLY, YEARLY, NEVER)

notify_usersfalse

List of strings

start_timestamp

When the monitor starts tracking, as an RFC3339 timestamp. Leave it out to start now: Atlas then emits Snowflake's START_TIMESTAMP = IMMEDIATELY, the only form that keeps working, since a literal is rejected once it is in the past. The value Snowflake records is not compared back, so omitting it reports no change.

falsestring

resource_monitor blocks​

resource_monitor.trigger​

resource_monitor.trigger attributes​
NameRequiredValue
actiontrue

enum (SUSPEND, SUSPEND_IMMEDIATE, NOTIFY)

thresholdtrueint
resource_monitor.trigger blocks​

resource_monitor.trigger.annotation​

resource_monitor.trigger.annotation constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Allow unknown blockstrue
Allow unknown attributestrue
resource_monitor.trigger constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue

resource_monitor constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., resource_monitor "name" )true

role​

role attributes​

NameRequiredValue
commentfalsestring
member_offalse

List of values, where each can be one of:

  1. Object reference to role
  2. Object reference to database_role

role constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., role "name" )true

row_access_policy​

The row_access_policy block describes a Snowflake row access policy in a database schema.

row_access_policy "sales_policy" {
schema = schema.public
arg "sales_region" {
type = varchar
}
as = "current_role() = 'ADMIN' or sales_region = 'US'"
comment = "Restrict rows by sales region"
}

row_access_policy attributes​

NameRequiredValue
astruestring
commentfalsestring
depends_onfalse

List of object references

schematrue

Object reference to schema

row_access_policy blocks​

row_access_policy.arg​

row_access_policy.arg attributes​
NameRequiredValue
typetrue

Argument type can be one of:

  1. Schema type
  2. Raw expression defined with sql("expr")
row_access_policy.arg constraints​
ConstraintValue
Requiredfalse
Require Name (e.g., row_access_policy.arg "name" )true

row_access_policy.tag​

The tag block describes the association of a Snowflake tag with a supported object (e.g., table, view, column, etc.).

table "USERS" {
schema = schema.SALES
retention_time = 1
column "CUSTOMER_ID" {
null = true
type = NUMBER(38)
}
column "EMAIL" {
null = true
type = VARCHAR(16777216)
}
tag {
ref = tag.DATA_DOMAIN
value = "customer_management"
}
}
row_access_policy.tag attributes​
NameRequiredValue
reftrue

Tag reference can be one of:

  1. Object reference to tag
  2. string
valuetruestring
row_access_policy.tag constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue

row_access_policy constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., row_access_policy "name" )true
Allow Qualifier (e.g., row_access_policy "schema" "name" )true

schema​

The schema block describes a database schema.

schema "public" {
...
}

schema attributes​

NameRequiredValue
catalogfalsestring
commentfalsestring
default_ddl_collationfalsestring
external_volumefalse

External volume reference can be one of:

  1. Object reference to external_volume
  2. string
iceberg_merge_on_read_behaviorfalse

enum (AUTO, ENABLED, DISABLED)

iceberg_version_defaultfalseint
managed_accessfalsebool
max_data_extension_timefalseint
namefalsestring
replace_invalid_charactersfalsebool
retention_timefalseint
storage_serialization_policyfalse

enum (COMPATIBLE, OPTIMIZED)

transientfalsebool

schema blocks​

schema.annotation​

schema.annotation constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Allow unknown blockstrue
Allow unknown attributestrue

schema.tag​

The tag block describes the association of a Snowflake tag with a supported object (e.g., table, view, column, etc.).

table "USERS" {
schema = schema.SALES
retention_time = 1
column "CUSTOMER_ID" {
null = true
type = NUMBER(38)
}
column "EMAIL" {
null = true
type = VARCHAR(16777216)
}
tag {
ref = tag.DATA_DOMAIN
value = "customer_management"
}
}
schema.tag attributes​
NameRequiredValue
reftrue

Tag reference can be one of:

  1. Object reference to tag
  2. string
valuetruestring
schema.tag constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue

schema constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., schema "name" )true

secret​

The secret block describes a Snowflake secret in a database schema.

secret "data_gen_key" {
schema = schema.public
type = SYMMETRIC_KEY
algorithm = GENERIC
}

The versioned workflow does not support a secret whose type carries a password, a secret string, or a refresh token: they are written only by schema apply. The api_authentication of a CLOUD_PROVIDER_TOKEN secret cannot be changed after it is created.

secret attributes​

NameRequiredValue
algorithmfalse

enum (GENERIC)

api_authenticationfalsestring
commentfalsestring
oauth_refresh_tokenfalsestring
oauth_refresh_token_expiry_timefalsestring
oauth_scopesfalse

List of strings

passwordfalsestring
schematrue

Object reference to schema

secret_stringfalsestring
typetrue

enum (OAUTH2, PASSWORD, GENERIC_STRING, CLOUD_PROVIDER_TOKEN, SYMMETRIC_KEY, WORKLOAD_IDENTITY_FEDERATION)

usernamefalsestring

secret constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., secret "name" )true
Allow Qualifier (e.g., secret "schema" "name" )true
Mutually exclusive sets[oauth_scopes, oauth_refresh_token]

sequence​

The sequence block describes a Snowflake sequence in a database schema.

sequence "myseq" {
schema = schema.public
start = 1
increment = 1
order = true
comment = "My sequence"
}

sequence attributes​

NameRequiredValue
commentfalsestring
incrementfalseint
orderfalsebool
schematrue

Object reference to schema

startfalseint

sequence blocks​

sequence.annotation​

sequence.annotation constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Allow unknown blockstrue
Allow unknown attributestrue

sequence constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., sequence "name" )true
Allow Qualifier (e.g., sequence "schema" "name" )true

stage​

The stage block describes a Snowflake stage in a database schema.

stage "mystage" {
schema = schema.public
url = "s3://mybucket/data/"
storage_integration = "my_integration"
directory_enabled = true
comment = "This is my stage"
}

stage attributes​

NameRequiredValue
commentfalsestring
credentialsfalsemap
directory_enabledfalsebool
file_formatfalse

File format options or reference can be one of:

  1. Object reference to file_format
  2. map
schematrue

Object reference to schema

storage_integrationfalsestring
urlfalsestring

stage blocks​

stage.tag​

The tag block describes the association of a Snowflake tag with a supported object (e.g., table, view, column, etc.).

table "USERS" {
schema = schema.SALES
retention_time = 1
column "CUSTOMER_ID" {
null = true
type = NUMBER(38)
}
column "EMAIL" {
null = true
type = VARCHAR(16777216)
}
tag {
ref = tag.DATA_DOMAIN
value = "customer_management"
}
}
stage.tag attributes​
NameRequiredValue
reftrue

Tag reference can be one of:

  1. Object reference to tag
  2. string
valuetruestring
stage.tag constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue

stage constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., stage "name" )true
Allow Qualifier (e.g., stage "schema" "name" )true
Mutually exclusive sets[storage_integration, credentials]

table​

The table block describes a table in a database schema.

table "users" {
schema = schema.public
column "id" {
type = int
}
...
}

table attributes​

NameRequiredValue
change_trackingfalsebool
cluster_byfalse

List of strings

commentfalsestring
depends_onfalse

List of object references

enable_schema_evolutionfalsebool
max_data_extension_timefalseint
retention_timefalseint
schematrue

Object reference to schema

transientfalsebool

table blocks​

table.annotation​

table.annotation constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Allow unknown blockstrue
Allow unknown attributestrue

table.column​

table.column attributes​
NameRequiredValue
asfalsestring
collatefalsestring
commentfalsestring
defaultfalse

Column default value can be one of:

  1. bool
  2. string
  3. number
  4. Raw expression defined with sql("expr")
nullfalsebool
typetrue

Column type can be one of:

  1. Schema type
  2. Raw expression defined with sql("expr")
table.column blocks​

table.column.annotation​

table.column.annotation constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Allow unknown blockstrue
Allow unknown attributestrue

table.column.identity​

table.column.identity attributes​
NameRequiredValue
incrementfalseint
orderfalse

enum (ORDER, NOORDER)

startfalseint

table.column.policy.masking​

table.column.policy.masking attributes​
NameRequiredValue
reftrue

Policy reference can be one of:

  1. Object reference to masking_policy
  2. string
usingfalse

List of strings

table.column.policy.masking constraints​
ConstraintValue
Requiredfalse
Repeatabletrue

table.column.policy.projection​

table.column.policy.projection attributes​
NameRequiredValue
reftrue

Policy reference can be one of:

  1. Object reference to projection_policy
  2. string
table.column.policy.projection constraints​
ConstraintValue
Requiredfalse
Repeatabletrue

table.column.tag​

The tag block describes the association of a Snowflake tag with a supported object (e.g., table, view, column, etc.).

table "USERS" {
schema = schema.SALES
retention_time = 1
column "CUSTOMER_ID" {
null = true
type = NUMBER(38)
}
column "EMAIL" {
null = true
type = VARCHAR(16777216)
}
tag {
ref = tag.DATA_DOMAIN
value = "customer_management"
}
}
table.column.tag attributes​
NameRequiredValue
reftrue

Tag reference can be one of:

  1. Object reference to tag
  2. string
valuetruestring
table.column.tag constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue
table.column constraints​
ConstraintValue
Requiredfalse
Require Name (e.g., table.column "name" )true

table.foreign_key​

table.foreign_key attributes​
NameRequiredValue
columnstrue

Foreign key columns can be one of:

  1. List of object reference to column
  2. List of object reference to table.column
commentfalsestring
ref_columnstrue

Foreign key reference columns can be one of:

  1. List of object reference to column
  2. List of object reference to table.column
table.foreign_key constraints​
ConstraintValue
Requiredfalse
Require Name (e.g., table.foreign_key "name" )true

table.policy.aggregation​

table.policy.aggregation attributes​
NameRequiredValue
entity_keyfalse

List of strings

reftrue

Policy reference can be one of:

  1. Object reference to aggregation_policy
  2. string
table.policy.aggregation constraints​
ConstraintValue
Requiredfalse
Repeatabletrue

table.policy.join​

table.policy.join attributes​
NameRequiredValue
reftrue

Policy reference can be one of:

  1. Object reference to join_policy
  2. string
table.policy.join constraints​
ConstraintValue
Requiredfalse
Repeatabletrue

table.policy.row_access​

table.policy.row_access attributes​
NameRequiredValue
columnstrue

List of strings

reftrue

Policy reference can be one of:

  1. Object reference to row_access_policy
  2. string
table.policy.row_access constraints​
ConstraintValue
Requiredfalse
Repeatabletrue

table.primary_key​

table.primary_key attributes​
NameRequiredValue
columnstrue

Index columns can be one of:

  1. List of object reference to column
  2. List of object reference to table.column
commentfalsestring

table.tag​

The tag block describes the association of a Snowflake tag with a supported object (e.g., table, view, column, etc.).

table "USERS" {
schema = schema.SALES
retention_time = 1
column "CUSTOMER_ID" {
null = true
type = NUMBER(38)
}
column "EMAIL" {
null = true
type = VARCHAR(16777216)
}
tag {
ref = tag.DATA_DOMAIN
value = "customer_management"
}
}
table.tag attributes​
NameRequiredValue
reftrue

Tag reference can be one of:

  1. Object reference to tag
  2. string
valuetruestring
table.tag constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue

table.unique​

table.unique attributes​
NameRequiredValue
columnstrue

Index columns can be one of:

  1. List of object reference to column
  2. List of object reference to table.column
commentfalsestring
table.unique constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Mutually exclusive sets[columns, on]
One of required sets[columns, on]

table constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., table "name" )true
Allow Qualifier (e.g., table "schema" "name" )true

tag​

The tag block describes a Snowflake tag in a database schema.

tag "public" "cost_center" {
schema = schema.public
allowed_values = ["finance", "engineering", "sales"]
propagate = ON_DEPENDENCY
on_conflict = ALLOWED_VALUES_SEQUENCE
comment = "cost center tag"
}

tag attributes​

NameRequiredValue
allowed_valuesfalse

List of strings

commentfalsestring
on_conflictfalse

Conflict resolution strategy can be one of:

  1. enum (ALLOWED_VALUES_SEQUENCE)
  2. string
propagatefalse

enum (ON_DEPENDENCY, ON_DATA_MOVEMENT, ON_DEPENDENCY_AND_DATA_MOVEMENT)

schematrue

Object reference to schema

tag constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., tag "name" )true
Allow Qualifier (e.g., tag "schema" "name" )true

task​

The task block describes a Snowflake task in a database schema.

task "my_task" {
schema = schema.public
schedule = "5 MINUTE"
warehouse = "my_wh"
as = "INSERT INTO t1 SELECT * FROM t2"
comment = "This is my task"
}

task attributes​

NameRequiredValue
afterfalse

List of object references

astruestring
commentfalsestring
conditionfalsestring
configfalsestring
depends_onfalse

List of object references

error_integrationfalsestring
execute_asfalsestring
finalizefalse

Object reference

log_levelfalsestring
overlap_policyfalse

enum (NO_OVERLAP, ALLOW_CHILD_OVERLAP)

query_tagfalsestring
schedulefalsestring
schematrue

Object reference to schema

serverless_task_max_statement_sizefalsestring
serverless_task_min_statement_sizefalsestring
success_integrationfalsestring
suspend_task_after_num_failuresfalseint
target_completion_intervalfalsestring
task_auto_retry_attemptsfalseint
timezonefalsestring
user_task_minimum_trigger_interval_in_secondsfalseint
user_task_timeout_msfalseint
warehousefalse

Warehouse name or reference can be one of:

  1. Object reference to warehouse
  2. string

task blocks​

task.tag​

The tag block describes the association of a Snowflake tag with a supported object (e.g., table, view, column, etc.).

table "USERS" {
schema = schema.SALES
retention_time = 1
column "CUSTOMER_ID" {
null = true
type = NUMBER(38)
}
column "EMAIL" {
null = true
type = VARCHAR(16777216)
}
tag {
ref = tag.DATA_DOMAIN
value = "customer_management"
}
}
task.tag attributes​
NameRequiredValue
reftrue

Tag reference can be one of:

  1. Object reference to tag
  2. string
valuetruestring
task.tag constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue

task constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., task "name" )true
Allow Qualifier (e.g., task "schema" "name" )true
Mutually exclusive sets[schedule, after], [schedule, finalize], [after, finalize], [overlap_policy, after], [overlap_policy, finalize]

user​

user attributes​

NameRequiredValue
commentfalsestring
member_offalse

List of values, where each can be one of:

  1. Object reference to role
  2. Object reference to database_role

user constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., user "name" )true

view​

The view block describes a view in a database schema.

view "clean_users" {
schema = schema.public
column "id" {
type = int
}
...
}

view attributes​

NameRequiredValue
astruestring
commentfalsestring
depends_onfalse

List of object references

schematrue

Object reference to schema

securefalsebool

view blocks​

view.annotation​

view.annotation constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Allow unknown blockstrue
Allow unknown attributestrue

view.column​

view.column attributes​
NameRequiredValue
commentfalsestring
defaultfalse

Column default value can be one of:

  1. bool
  2. string
  3. number
  4. Raw expression defined with sql("expr")
nullfalsebool
typefalse

Column type can be one of:

  1. Schema type
  2. Raw expression defined with sql("expr")
view.column blocks​

view.column.annotation​

view.column.annotation constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Allow unknown blockstrue
Allow unknown attributestrue

view.column.policy.masking​

view.column.policy.masking attributes​
NameRequiredValue
reftrue

Policy reference can be one of:

  1. Object reference to masking_policy
  2. string
usingfalse

List of strings

view.column.policy.masking constraints​
ConstraintValue
Requiredfalse
Repeatabletrue

view.column.policy.projection​

view.column.policy.projection attributes​
NameRequiredValue
reftrue

Policy reference can be one of:

  1. Object reference to projection_policy
  2. string
view.column.policy.projection constraints​
ConstraintValue
Requiredfalse
Repeatabletrue

view.column.tag​

The tag block describes the association of a Snowflake tag with a supported object (e.g., table, view, column, etc.).

table "USERS" {
schema = schema.SALES
retention_time = 1
column "CUSTOMER_ID" {
null = true
type = NUMBER(38)
}
column "EMAIL" {
null = true
type = VARCHAR(16777216)
}
tag {
ref = tag.DATA_DOMAIN
value = "customer_management"
}
}
view.column.tag attributes​
NameRequiredValue
reftrue

Tag reference can be one of:

  1. Object reference to tag
  2. string
valuetruestring
view.column.tag constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue
view.column constraints​
ConstraintValue
Requiredfalse
Require Name (e.g., view.column "name" )true

view.policy.aggregation​

view.policy.aggregation attributes​
NameRequiredValue
entity_keyfalse

List of strings

reftrue

Policy reference can be one of:

  1. Object reference to aggregation_policy
  2. string
view.policy.aggregation constraints​
ConstraintValue
Requiredfalse
Repeatabletrue

view.policy.join​

view.policy.join attributes​
NameRequiredValue
reftrue

Policy reference can be one of:

  1. Object reference to join_policy
  2. string
view.policy.join constraints​
ConstraintValue
Requiredfalse
Repeatabletrue

view.policy.row_access​

view.policy.row_access attributes​
NameRequiredValue
columnstrue

List of strings

reftrue

Policy reference can be one of:

  1. Object reference to row_access_policy
  2. string
view.policy.row_access constraints​
ConstraintValue
Requiredfalse
Repeatabletrue

view.tag​

The tag block describes the association of a Snowflake tag with a supported object (e.g., table, view, column, etc.).

table "USERS" {
schema = schema.SALES
retention_time = 1
column "CUSTOMER_ID" {
null = true
type = NUMBER(38)
}
column "EMAIL" {
null = true
type = VARCHAR(16777216)
}
tag {
ref = tag.DATA_DOMAIN
value = "customer_management"
}
}
view.tag attributes​
NameRequiredValue
reftrue

Tag reference can be one of:

  1. Object reference to tag
  2. string
valuetruestring
view.tag constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue

view constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., view "name" )true
Allow Qualifier (e.g., view "schema" "name" )true

warehouse​

The warehouse block describes a Snowflake virtual warehouse.

warehouse "my_wh" {
size = "X-Small"
type = STANDARD
auto_suspend = 600
auto_resume = true
comment = "My warehouse"
}

warehouse attributes​

NameRequiredValue
auto_resumefalsebool
auto_suspendfalseint
commentfalsestring
enable_query_accelerationfalsebool
generationfalse

enum (1, 2)

max_cluster_countfalseint
max_concurrency_levelfalseint
min_cluster_countfalseint
query_acceleration_max_scale_factorfalseint
resource_constraintfalse

enum (STANDARD_GEN_1, STANDARD_GEN_2, MEMORY_1X, MEMORY_1X_x86, MEMORY_16X, MEMORY_16X_x86, MEMORY_64X, MEMORY_64X_x86)

resource_monitorfalse

Resource monitor name or reference can be one of:

  1. Object reference to resource_monitor
  2. string
scaling_policyfalse

enum (STANDARD, ECONOMY)

sizefalse

enum (XSMALL, SMALL, MEDIUM, LARGE, XLARGE, XXLARGE, XXXLARGE, X4LARGE, X5LARGE, X6LARGE)

statement_queued_timeout_in_secondsfalseint
statement_timeout_in_secondsfalseint
typefalse

enum (STANDARD, SNOWPARK-OPTIMIZED, ADAPTIVE)

warehouse blocks​

warehouse.tag​

The tag block describes the association of a Snowflake tag with a supported object (e.g., table, view, column, etc.).

table "USERS" {
schema = schema.SALES
retention_time = 1
column "CUSTOMER_ID" {
null = true
type = NUMBER(38)
}
column "EMAIL" {
null = true
type = VARCHAR(16777216)
}
tag {
ref = tag.DATA_DOMAIN
value = "customer_management"
}
}
warehouse.tag attributes​
NameRequiredValue
reftrue

Tag reference can be one of:

  1. Object reference to tag
  2. string
valuetruestring
warehouse.tag constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue

warehouse constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., warehouse "name" )true