Snowflake Schema
schema
The schema
block describes a database schema.
schema "public" {
...
}
schema
attributes
Name | Required | Value |
---|---|---|
comment | false | string |
managed_access | false | bool |
name | false | string |
retention_time | false | int |
transient | false | bool |
schema
constraints
Constraint | Value |
---|---|
Required | false |
Require Name (e.g., schema "name" ) | true |
table
The table
block describes a table in a database schema.
table "users" {
schema = schema.public
column "id" {
type = int
}
...
}
table
attributes
Name | Required | Value |
---|---|---|
comment | false | string |
managed_access | false | bool |
retention_time | false | int |
schema | true | Object reference to |
transient | false | bool |
table
blocks
table.column
table.column
attributes
Name | Required | Value |
---|---|---|
collate | false | string |
comment | false | string |
default | false | Column default value can be one of:
|
null | false | bool |
type | true | Column type can be one of:
|
table.column
constraints
Constraint | Value |
---|---|
Required | false |
Require Name (e.g., table.column "name" ) | true |
table.index
table.index
attributes
Name | Required | Value |
---|---|---|
columns | false | Index columns can be one of:
|
comment | false | string |
unique | false | bool |
table.index
constraints
Constraint | Value |
---|---|
Required | false |
Require Name (e.g., table.index "name" ) | true |
Mutually exclusive sets | [columns, on] |
One of required sets | [columns, on] |
table.primary_key
table.primary_key
attributes
Name | Required | Value |
---|---|---|
columns | false | Index columns can be one of:
|
comment | false | string |
table.primary_key
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | false |
Mutually exclusive sets | [columns, on] |
One of required sets | [columns, on] |
table
constraints
Constraint | Value |
---|---|
Required | false |
Require Name (e.g., table "name" ) | true |
Allow Qualifier (e.g., table "schema" "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
Name | Required | Value |
---|---|---|
as | true | string |
comment | false | string |
depends_on | false | List of object references |
schema | true | Object reference to |
view
blocks
view.column
view.column
attributes
Name | Required | Value |
---|---|---|
comment | false | string |
default | false | Column default value can be one of:
|
null | false | bool |
type | true | Column type can be one of:
|
view.column
constraints
Constraint | Value |
---|---|
Required | false |
Require Name (e.g., view.column "name" ) | true |
view
constraints
Constraint | Value |
---|---|
Required | false |
Require Name (e.g., view "name" ) | true |
Allow Qualifier (e.g., view "schema" "name" ) | true |