ClickHouse Schema
data
The data block defines seed/lookup data for a table.
data {
table = table.countries
rows = [
{ code = "US", name = "United States" },
{ code = "CA", name = "Canada" },
]
}
data attributes
| Name | Required | Value |
|---|---|---|
rows | true | Any value |
table | true | Object reference to |
data constraints
| Constraint | Value |
|---|---|
| Required | false |
| Require Name | false |
| Repeatable | true |
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
}
...
}
dictionary attributes
| Name | Required | Value |
|---|---|---|
comment | false | string |
depends_on | false | List of object references |
layout | true | Raw expression defined with |
schema | true | Object reference to |
settings | false | map |
source | true | Raw expression defined with |
dictionary 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 (e.g., dictionary.attribute "name" ) | true |
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 (e.g., dictionary.key "name" ) | true |
dictionary.lifetime
dictionary.lifetime attributes
| Name | Required | Value |
|---|---|---|
max | true | int |
min | true | int |
dictionary constraints
| Constraint | Value |
|---|---|
| Required | false |
Require Name (e.g., dictionary "name" ) | true |
Allow Qualifier (e.g., dictionary "schema" "name" ) | true |
function
The function block describes a ClickHouse User-Defined Function (UDF).
function "plus_one" {
as = "(x) -> x + 1"
}
function attributes
| Name | Required | Value |
|---|---|---|
as | true | string |
function blocks
function.annotation
function.annotation constraints
| Constraint | Value |
|---|---|
| Required | false |
| Require Name | false |
| Allow unknown blocks | true |
| Allow unknown attributes | true |
function constraints
| Constraint | Value |
|---|---|
| Required | false |
Require Name (e.g., function "name" ) | true |
materialized
The materialized block describes a materialized view in a database schema.
materialized "name" {
schema = schema.public
column "total" {
null = true
type = numeric
}
...
}