Skip to main content

Redshift Schema

materialized

The materialized block describes a materialized view in a database schema.

materialized "name" {
schema = schema.public
column "total" {
null = true
type = numeric
}
...
}

Attributes

NameRequiredValue
astruestring
auto_refreshfalsebool
commentfalsestring
depends_onfalse

List of object references

schematrue

Object reference to schema

Blocks

materialized.column

materialized.column attributes
NameRequiredValue
commentfalsestring
nullfalsebool
typetrue

Column type can be one of:

  1. Schema type
  2. Raw expression defined with sql("expr")
materialized.column constraints
ConstraintValue
Requiredfalse
Require Nametrue
Repeatablefalse
Allow unknown blocksfalse
Allow unknown attributesfalse

materialized.distribution

materialized.distribution attributes
NameRequiredValue
columnfalse

Object reference

stylefalse

enum (EVEN, ALL, KEY)

materialized.distribution constraints
ConstraintValue
Requiredfalse
Require Namefalse
Repeatablefalse
Allow unknown blocksfalse
Allow unknown attributesfalse

materialized.sort

materialized.sort attributes
NameRequiredValue
columnsfalse

List of object reference to column

stylefalse

enum (COMPOUND)

materialized.sort constraints
ConstraintValue
Requiredfalse
Require Namefalse
Repeatablefalse
Allow unknown blocksfalse
Allow unknown attributesfalse

Constraints

ConstraintValue
Requiredfalse
Require Nametrue
Allow Qualifiertrue
Repeatablefalse
Allow unknown blocksfalse
Allow unknown attributesfalse

schema

The schema block describes a database schema.

schema "public" {
...
}

Attributes

NameRequiredValue
commentfalsestring
namefalsestring

Constraints

ConstraintValue
Requiredfalse
Require Nametrue
Allow Qualifierfalse
Repeatablefalse
Allow unknown blocksfalse
Allow unknown attributesfalse

table

The table block describes a table in a database schema.

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

Attributes

NameRequiredValue
commentfalsestring
schematrue

Object reference to schema

Blocks

table.column

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")
encodefalse

enum (RAW, AZ64, BYTEDICT, DELTA, DELTA32K, LZO, MOSTLY8, MOSTLY16, MOSTLY32, RUNLENGTH, TEXT255, TEXT32K, ZSTD)

nullfalsebool
typetrue

Column type can be one of:

  1. Schema type
  2. Raw expression defined with sql("expr")
table.column constraints
ConstraintValue
Requiredfalse
Require Nametrue
Repeatablefalse
Allow unknown blocksfalse
Allow unknown attributesfalse

table.distribution

table.distribution attributes
NameRequiredValue
columnfalse

Object reference

stylefalse

enum (EVEN, KEY, ALL, AUTO)

table.distribution constraints
ConstraintValue
Requiredfalse
Require Namefalse
Repeatablefalse
Allow unknown blocksfalse
Allow unknown attributesfalse

table.sort

table.sort attributes
NameRequiredValue
columnsfalse

List of object reference to column

stylefalse

enum (AUTO, COMPOUND, INTERLEAVED)

table.sort constraints
ConstraintValue
Requiredfalse
Require Namefalse
Repeatablefalse
Allow unknown blocksfalse
Allow unknown attributesfalse

Constraints

ConstraintValue
Requiredfalse
Require Nametrue
Allow Qualifiertrue
Repeatablefalse
Allow unknown blocksfalse
Allow unknown attributesfalse

view

The view block describes a view in a database schema.

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

Attributes

NameRequiredValue
astruestring
commentfalsestring
depends_onfalse

List of object references

schematrue

Object reference to schema

Blocks

view.column

view.column attributes
NameRequiredValue
commentfalsestring
nullfalsebool
typetrue

Column type can be one of:

  1. Schema type
  2. Raw expression defined with sql("expr")
view.column constraints
ConstraintValue
Requiredfalse
Require Nametrue
Repeatablefalse
Allow unknown blocksfalse
Allow unknown attributesfalse

Constraints

ConstraintValue
Requiredfalse
Require Nametrue
Allow Qualifiertrue
Repeatablefalse
Allow unknown blocksfalse
Allow unknown attributesfalse