ClickHouse Schema
dictionary
The dictionary
block describes a dictionary in a database schema.
dictionary "name" {
schema = schema.public
source = sql("CLICKHOUSE(TABLE)")
layout = sql("HASH()")
key "id" {
type = UInt64
}
attribute "name" {
type = String
}
lifetime {
min = 0
max = 0
}
...
}
Attributes
Name | Required | Value |
---|---|---|
comment | false | string |
layout | true | Raw expression defined with |
schema | true | Object reference to |
settings | false | map |
source | true | Raw expression defined with |
Blocks
dictionary.attribute
dictionary.attribute
attributes
Name | Required | Value |
---|---|---|
default | false | Column default expression can be one of:
|
null | false | bool |
type | true | Attribute type can be one of:
|
dictionary.attribute
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | true |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
dictionary.key
dictionary.key
attributes
Name | Required | Value |
---|---|---|
default | false | Column default expression can be one of:
|
null | false | bool |
type | true | Attribute type can be one of:
|
dictionary.key
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | true |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
dictionary.lifetime
dictionary.lifetime
attributes
Name | Required | Value |
---|---|---|
max | true | int |
min | true | int |
dictionary.lifetime
constraints
Constraint | Value |
---|---|
Required | true |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
Constraints
Constraint | Value |
---|---|
Required | false |
Require Name | true |
Allow Qualifier | true |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
materialized
The materialized
block describes a materialized view in a database schema.
materialized "name" {
schema = schema.public
column "total" {
null = true
type = numeric
}
...
}
Attributes
Name | Required | Value |
---|---|---|
as | true | string |
comment | false | string |
depends_on | false | List of object references |
engine | false | Table engine can be one of:
|
populate | false | bool |
schema | true | Object reference to |
to | false | Define structure of view can be one of: |
Blocks
materialized.column
materialized.column
attributes
Name | Required | Value |
---|---|---|
comment | false | string |
null | false | bool |
type | true | Column type can be one of:
|
materialized.column
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | true |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
materialized.primary_key
materialized.primary_key
attributes
Name | Required | Value |
---|---|---|
columns | false | Primary key columns can be one of:
|
comment | false | string |
materialized.primary_key
blocks
materialized.primary_key.on
materialized.primary_key.on
attributes
Name | Required | Value |
---|---|---|
column | false | Primary key column can be one of:
|
expr | false | string |
materialized.primary_key.on
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | false |
Repeatable | true |
Allow unknown blocks | false |
Allow unknown attributes | false |
Mutually exclusive sets | [column, expr] |
One of required sets | [column, expr] |
materialized.primary_key
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
Mutually exclusive sets | [columns, on] |
One of required sets | [columns, on] |
Constraints
Constraint | Value |
---|---|
Required | false |
Require Name | true |
Allow Qualifier | true |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
Mutually exclusive sets | [to, engine] , [to, populate] |
One of required sets | [to, engine] |
schema
The schema
block describes a database schema.
schema "public" {
...
}
Attributes
Name | Required | Value |
---|---|---|
comment | false | string |
engine | false | Schema engine can be one of:
|
name | false | string |
Constraints
Constraint | Value |
---|---|
Required | false |
Require Name | true |
Allow Qualifier | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
table
The table
block describes a table in a database schema.
table "users" {
schema = schema.public
column "id" {
type = int
}
...
}
Attributes
Name | Required | Value |
---|---|---|
comment | false | string |
engine | false | Table engine can be one of:
|
schema | true | Object reference to |
settings | false | map |
ttl | false | Column ttl can be one of:
|
Blocks
table.check
table.check
attributes
Name | Required | Value |
---|---|---|
comment | false | string |
expr | true | string |
table.check
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | false |
Repeatable | true |
Allow unknown blocks | false |
Allow unknown attributes | false |
table.column
table.column
attributes
Name | Required | Value |
---|---|---|
codec | false | Column codec can be one of:
|
comment | false | string |
default | false | Column default expression can be one of:
|
default_kind | false | Column default kind can be one of:
|
null | false | bool |
ttl | false | Column ttl can be one of:
|
type | true | Column type can be one of:
|
table.column
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | true |
Repeatable | true |
Allow unknown blocks | false |
Allow unknown attributes | false |
table.engine.TimeSeries
table.engine.TimeSeries
attributes
Name | Required | Value |
---|---|---|
data | false | Object reference to |
metrics | false | Object reference to |
tags | false | Object reference to |
table.engine.TimeSeries
constraints
Constraint | Value |
---|---|
Required | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
table.index
table.index
attributes
Name | Required | Value |
---|---|---|
comment | false | string |
granularity | false | int |
type | true | Index type can be one of:
|
table.index
blocks
table.index.on
table.index.on
attributes
Name | Required | Value |
---|---|---|
expr | true | string |
table.index.on
constraints
Constraint | Value |
---|---|
Required | true |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
table.index
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | true |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
table.primary_key
table.primary_key
attributes
Name | Required | Value |
---|---|---|
columns | false | Primary key columns can be one of:
|
comment | false | string |
table.primary_key
blocks
table.primary_key.on
table.primary_key.on
attributes
Name | Required | Value |
---|---|---|
column | false | Primary key column can be one of:
|
expr | false | string |
table.primary_key.on
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | false |
Repeatable | true |
Allow unknown blocks | false |
Allow unknown attributes | false |
Mutually exclusive sets | [column, expr] |
One of required sets | [column, expr] |
table.primary_key
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
Mutually exclusive sets | [columns, on] |
One of required sets | [columns, on] |
table.sort
table.sort
attributes
Name | Required | Value |
---|---|---|
columns | false | List of object reference to |
table.sort
blocks
table.sort.on
table.sort.on
attributes
Name | Required | Value |
---|---|---|
column | false | Object reference to |
expr | false | string |
table.sort.on
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | false |
Repeatable | true |
Allow unknown blocks | false |
Allow unknown attributes | false |
Mutually exclusive sets | [column, expr] |
One of required sets | [column, expr] |
table.sort
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
Mutually exclusive sets | [columns, on] |
One of required sets | [columns, on] |
Constraints
Constraint | Value |
---|---|
Required | false |
Require Name | true |
Allow Qualifier | true |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
view
The view
block describes a view in a database schema.
view "clean_users" {
schema = schema.public
column "id" {
type = int
}
...
}
Attributes
Name | Required | Value |
---|---|---|
as | true | string |
comment | false | string |
depends_on | false | List of object references |
schema | true | Object reference to |
Blocks
view.column
view.column
attributes
Name | Required | Value |
---|---|---|
comment | false | string |
null | false | bool |
type | true | Column type can be one of:
|
view.column
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | true |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
Constraints
Constraint | Value |
---|---|
Required | false |
Require Name | true |
Allow Qualifier | true |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
Mutually exclusive sets | [latest, git] |