Databricks 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 |
comment | false | string |
deterministic | false | bool |
lang | true | Function language can be one of:
|
return | false | Function return type can be one of:
|
schema | true | Object reference to |
sql_data_access | 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 |
|---|---|---|
comment | false | string |
default | false | Argument default value can be one of:
|
type | true | Argument type can be one of:
|
function.arg constraints
| Constraint | Value |
|---|---|
| Required | false |
Require Name (e.g., function.arg "name" ) | true |
| Repeatable | true |
function.return_table
function.return_table blocks
function.return_table.column
function.return_table.column attributes
| Name | Required | Value |
|---|---|---|
type | true | Function return_table column type can be one of:
|
function.return_table.column blocks
function.return_table.column.annotation
function.return_table.column.annotation constraints
| Constraint | Value |
|---|---|
| Required | false |
| Require Name | false |
| Allow unknown blocks | true |
| Allow unknown attributes | true |
function.return_table.column constraints
| Constraint | Value |
|---|---|
| Required | true |
Require Name (e.g., function.return_table.column "name" ) | true |
| 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 |
| Mutually exclusive sets | [return, return_table] |
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 |
collation | false | string |
comment | false | string |
depends_on | false | List of object references |
properties | false | map |
provider | false | string |
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.cluster
materialized.cluster attributes
| Name | Required | Value |
|---|---|---|
auto | false | bool |
columns | false | List of object reference to |
materialized.cluster constraints
| Constraint | Value |
|---|---|
| Required | false |
| Require Name | false |
| Mutually exclusive sets | [columns, auto] |
| One of required sets | [columns, auto] |
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.mask
materialized.column.mask attributes
| Name | Required | Value |
|---|---|---|
function | true | Object reference to |
using_columns | false | List of object reference to |
materialized.column constraints
| Constraint | Value |
|---|---|
| Required | false |
Require Name (e.g., materialized.column "name" ) | true |
materialized.expect
materialized.expect attributes
| Name | Required | Value |
|---|---|---|
expr | true | string |
on_violation | false |
|
materialized.expect constraints
| Constraint | Value |
|---|---|
| Required | false |
Require Name (e.g., materialized.expect "name" ) | true |
| Repeatable | true |
materialized.foreign_key
materialized.foreign_key attributes
| Name | Required | Value |
|---|---|---|
columns | true | Foreign key columns can be one of:
|
ref_columns | true | Foreign key reference columns can be one of:
|
materialized.foreign_key constraints
| Constraint | Value |
|---|---|
| Required | false |
Require Name (e.g., materialized.foreign_key "name" ) | true |
materialized.partition
materialized.partition attributes
| Name | Required | Value |
|---|---|---|
columns | false | List of object reference to |
materialized.primary_key
materialized.primary_key attributes
| Name | Required | Value |
|---|---|---|
columns | true | Primary key columns can be one of:
|
materialized.refresh
materialized.refresh attributes
| Name | Required | Value |
|---|---|---|
at_most | false | string |
cron | false | string |
every | false | string |
on_update | false | bool |
time_zone | false | string |
materialized.refresh constraints
| Constraint | Value |
|---|---|
| Required | false |
| Require Name | false |
| Mutually exclusive sets | [every, cron], [every, on_update], [cron, on_update] |
| One of required sets | [every, cron, on_update] |
materialized.row_filter
materialized.row_filter attributes
| Name | Required | Value |
|---|---|---|
columns | false | List of object reference to |
function | true | Object reference to |
materialized constraints
| Constraint | Value |
|---|---|
| Required | false |
Require Name (e.g., materialized "name" ) | true |
Allow Qualifier (e.g., materialized "schema" "name" ) | true |
| Mutually exclusive sets | [partition, cluster] |
permission
The permission block describes permissions (privileges) granted on database objects.
permission {
to = "user1"
for = table.users
privileges = [SELECT, MODIFY]
}
permission {
to = "admin"
for = schema.default
privileges = [MANAGE]
}
permission attributes
| Name | Required | Value |
|---|---|---|
for | true | Permission target resource can be one of: |
privileges | true | List of strings |
to | true | string |
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 |
comment | false | string |
deterministic | false | bool |
lang | true | Procedure language can be one of:
|
schema | true | Object reference to |
security | false |
|
sql_data_access | 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 |
|---|---|---|
comment | false | string |
default | false | Argument default value can be one of:
|
mode | false |
|
type | true | Argument type can be one of:
|
procedure.arg constraints
| Constraint | Value |
|---|---|
| Required | false |
Require Name (e.g., procedure.arg "name" ) | true |
| 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 |
schema
The schema block describes a database schema.
schema "public" {
...
}
schema attributes
| Name | Required | Value |
|---|---|---|
collation | false | string |
comment | 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 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 |
|---|---|---|
collation | false | string |
comment | false | string |
depends_on | false | List of object references |
location | false | string |
properties | false | map |
provider | 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.check
table.check attributes
| Name | Required | Value |
|---|---|---|
expr | true | string |
table.check constraints
| Constraint | Value |
|---|---|
| Required | false |
Require Name (e.g., table.check "name" ) | true |
| Repeatable | true |
table.cluster
table.cluster attributes
| Name | Required | Value |
|---|---|---|
auto | false | bool |
columns | false | List of object reference to |
table.cluster constraints
| Constraint | Value |
|---|---|
| Required | false |
| Require Name | false |
| Mutually exclusive sets | [columns, auto] |
| One of required sets | [columns, auto] |
table.column
table.column attributes
| Name | Required | Value |
|---|---|---|
as | false | string |
collation | false | string |
comment | false | string |
default | false | Column default expression can be one of:
|
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 |
|---|---|---|
by_default | false | bool |
increment | false | int |
start | false | int |
table.column.mask
table.column.mask attributes
| Name | Required | Value |
|---|---|---|
function | true | Object reference to |
using_columns | false | List of object reference to |
table.column constraints
| Constraint | Value |
|---|---|
| Required | false |
Require Name (e.g., table.column "name" ) | true |
| Mutually exclusive sets | [default, as, identity] |
table.foreign_key
table.foreign_key attributes
| Name | Required | Value |
|---|---|---|
columns | true | Foreign key columns can be one of:
|
ref_columns | true | Foreign key reference columns can be one of:
|
table.foreign_key constraints
| Constraint | Value |
|---|---|
| Required | false |
Require Name (e.g., table.foreign_key "name" ) | true |
table.partition
table.partition attributes
| Name | Required | Value |
|---|---|---|
columns | false | List of object reference to |
table.primary_key
table.primary_key attributes
| Name | Required | Value |
|---|---|---|
columns | true | Primary key columns can be one of:
|
table.row_filter
table.row_filter attributes
| Name | Required | Value |
|---|---|---|
columns | false | List of object reference to |
function | true | Object reference to |
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 |
collation | false | string |
comment | false | string |
depends_on | false | List of object references |
properties | false | map |
schema | true | Object reference to |
schema_binding | false |
|
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 |