Redshift Schema
function
The function block describes a function in a database schema.
function "positive" {
schema = schema.public
lang = SQL
arg "v" {
type = integer
}
...
}
function attributes
| Name | Required | Value |
|---|---|---|
as | true | string |
depends_on | false | List of object references |
lang | true | Function language can be one of:
|
return | false | Function return type can be one of:
|
schema | true | Object reference to |
volatility | false |
|
function blocks
function.annotation
function.annotation constraints
| Constraint | Value |
|---|---|
| Required | false |
| Require Name | false |
| Allow unknown blocks | true |
| Allow unknown attributes | true |
function.arg
function.arg attributes
| Name | Required | Value |
|---|---|---|
type | true | Function argument type can be one of:
|
function.arg constraints
| Constraint | Value |
|---|---|
| Required | false |
| Require Name | false |
| Repeatable | true |
function constraints
| Constraint | Value |
|---|---|
| Required | false |
Require Name (e.g., function "name" ) | true |
Allow Qualifier (e.g., function "schema" "name" ) | true |
| Repeatable | true |
materialized
The materialized block describes a materialized view in a database schema.
materialized "name" {
schema = schema.public
column "total" {
null = true
type = numeric
}
...
}
materialized attributes
| Name | Required | Value |
|---|---|---|
as | true | string |
auto_refresh | false | bool |
comment | false | string |
depends_on | false | List of object references |
schema | true | Object reference to |
materialized blocks
materialized.annotation
materialized.annotation constraints
| Constraint | Value |
|---|---|
| Required | false |
| Require Name | false |
| Allow unknown blocks | true |
| Allow unknown attributes | true |
materialized.column
materialized.column attributes
| Name | Required | Value |
|---|---|---|
comment | false | string |
null | false | bool |
type | true | Column type can be one of:
|
materialized.column blocks
materialized.column.annotation
materialized.column.annotation constraints
| Constraint | Value |
|---|---|
| Required | false |
| Require Name | false |
| Allow unknown blocks | true |
| Allow unknown attributes | true |
materialized.column constraints
| Constraint | Value |
|---|---|
| Required | false |
Require Name (e.g., materialized.column "name" ) | true |
materialized.distribution
materialized.distribution attributes
| Name | Required | Value |
|---|---|---|
column | false | Object reference |
style | false |
|
materialized.sort
materialized.sort attributes
| Name | Required | Value |
|---|---|---|
columns | false | List of object reference to |
style | false |
|
materialized constraints
| Constraint | Value |
|---|---|
| Required | false |
Require Name (e.g., materialized "name" ) | true |
Allow Qualifier (e.g., materialized "schema" "name" ) | true |
permission
The permission block describes privileges granted on database objects.
permission {
to = user.app
for = table.users
privileges = [SELECT]
}
permission attributes
| Name | Required | Value |
|---|---|---|
for | true | Permission target resource can be one of:
|
grantable | false | bool |
privileges | true | List of strings or/and |
to | true | Permission grantee can be one of: |
permission constraints
| Constraint | Value |
|---|---|
| Required | false |
| Require Name | false |
| Repeatable | 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
| Name | Required | Value |
|---|---|---|
as | true | string |
depends_on | false | List of object references |
lang | true | Procedure language can be one of:
|
schema | true | Object reference to |
security | false |
|
procedure blocks
procedure.annotation
procedure.annotation constraints
| Constraint | Value |
|---|---|
| Required | false |
| Require Name | false |
| Allow unknown blocks | true |
| Allow unknown attributes | true |
procedure.arg
procedure.arg attributes
| Name | Required | Value |
|---|---|---|
mode | false | Procedure argument mode can be one of:
|
type | true | Procedure argument type can be one of:
|
procedure.arg constraints
| Constraint | Value |
|---|---|
| Required | false |
| Require Name | false |
| Repeatable | true |
procedure constraints
| Constraint | Value |
|---|---|
| Required | false |
Require Name (e.g., procedure "name" ) | true |
Allow Qualifier (e.g., procedure "schema" "name" ) | true |
| Repeatable | true |
role
The role block describes a database role or group.
role "analysts" {
member_of = [role.readers]
comment = "Analytics team"
}
role attributes
| Name | Required | Value |
|---|---|---|
comment | false | string |
conn_limit | false | int |
create_db | false | bool |
external | false | bool |
group | false | bool |
member_of | false | List of object reference to |
name | false | string |
superuser | false | bool |
role constraints
| Constraint | Value |
|---|---|
| Required | false |
Require Name (e.g., role "name" ) | true |
schema
The schema block describes a database schema.
schema "public" {
...
}
schema attributes
| Name | Required | Value |
|---|---|---|
comment | false | string |
name | false | string |
schema blocks
schema.annotation
schema.annotation constraints
| Constraint | Value |
|---|---|
| Required | false |
| Require Name | false |
| Allow unknown blocks | true |
| Allow unknown attributes | true |
schema.external.data_catalog
schema.external.data_catalog attributes
| Name | Required | Value |
|---|---|---|
catalog_role | false | string |
database | false | string |
iam_role | false | string |
region | false | string |
schema.external.hive_metastore
schema.external.hive_metastore attributes
| Name | Required | Value |
|---|---|---|
database | false | string |
iam_role | false | string |
port | false | int |
uri | false | string |
schema.external.kafka
schema.external.kafka attributes
| Name | Required | Value |
|---|---|---|
authentication | false | Streaming authentication type can be one of:
|
authentication_arn | false | string |
iam_role | false | string |
region | false | string |
secret_arn | false | string |
uri | false | string |
schema.external.kinesis
schema.external.kinesis attributes
| Name | Required | Value |
|---|---|---|
iam_role | false | string |
region | false | string |
schema.external.msk
schema.external.msk attributes
| Name | Required | Value |
|---|---|---|
authentication | false | Streaming authentication type can be one of:
|
authentication_arn | false | string |
cluster_arn | false | string |
iam_role | false | string |
region | false | string |
secret_arn | false | string |
uri | false | string |
schema.external.mysql
schema.external.mysql attributes
| Name | Required | Value |
|---|---|---|
database | false | string |
iam_role | false | string |
port | false | int |
secret_arn | false | string |
uri | false | string |
schema.external.postgres
schema.external.postgres attributes
| Name | Required | Value |
|---|---|---|
database | false | string |
iam_role | false | string |
port | false | int |
schema | false | string |
secret_arn | false | string |
uri | false | string |
schema.external.redshift
schema.external.redshift attributes
| Name | Required | Value |
|---|---|---|
database | false | string |
schema | false | string |
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 |
schema | true | Object reference to |
table blocks
table.annotation
table.annotation constraints
| Constraint | Value |
|---|---|
| Required | false |
| Require Name | false |
| Allow unknown blocks | true |
| Allow unknown attributes | true |
table.column
table.column attributes
| Name | Required | Value |
|---|---|---|
comment | false | string |
default | false | Column default value can be one of:
|
encode | false |
|
null | false | bool |
type | true | Column type can be one of:
|
table.column blocks
table.column.annotation
table.column.annotation constraints
| Constraint | Value |
|---|---|
| Required | false |
| Require Name | false |
| Allow unknown blocks | true |
| Allow unknown attributes | true |
table.column.identity
table.column.identity attributes
| Name | Required | Value |
|---|---|---|
generated | false |
|
seed | false | int |
step | false | int |
table.column constraints
| Constraint | Value |
|---|---|
| Required | false |
Require Name (e.g., table.column "name" ) | true |
table.distribution
table.distribution attributes
| Name | Required | Value |
|---|---|---|
column | false | Object reference |
style | false |
|
table.sort
table.sort attributes
| Name | Required | Value |
|---|---|---|
columns | false | List of object reference to |
style | false |
|
table constraints
| Constraint | Value |
|---|---|
| Required | false |
Require Name (e.g., table "name" ) | true |
Allow Qualifier (e.g., table "schema" "name" ) | true |
user
The user block describes a database user.
user "app_user" {
password = "<sensitive>"
valid_until = "2025-12-31 23:59:59+00"
member_of = [role.analysts]
}
user attributes
| Name | Required | Value |
|---|---|---|
comment | false | string |
conn_limit | false | int |
create_db | false | bool |
external | false | bool |
group | false | bool |
member_of | false | List of object reference to |
name | false | string |
password | false | string |
superuser | false | bool |
valid_until | false | string |
user constraints
| Constraint | Value |
|---|---|
| Required | false |
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
| Name | Required | Value |
|---|---|---|
as | true | string |
comment | false | string |
depends_on | false | List of object references |
schema | true | Object reference to |
view blocks
view.annotation
view.annotation constraints
| Constraint | Value |
|---|---|
| Required | false |
| Require Name | false |
| Allow unknown blocks | true |
| Allow unknown attributes | true |
view.column
view.column attributes
| Name | Required | Value |
|---|---|---|
comment | false | string |
null | false | bool |
type | true | Column type can be one of:
|
view.column blocks
view.column.annotation
view.column.annotation constraints
| Constraint | Value |
|---|---|
| Required | false |
| Require Name | false |
| Allow unknown blocks | true |
| Allow unknown attributes | true |
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 |