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 |
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 |
function blocks
function.arg
function.arg attributes
| Name | Required | Value |
|---|---|---|
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 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 |
schema | 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 |
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 |
deterministic | false | bool |
lang | true | Procedure language can be one of:
|
schema | true | Object reference to |
security | false |
|
procedure blocks
procedure.arg
procedure.arg attributes
| Name | Required | Value |
|---|---|---|
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 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 |
location | false | string |
properties | false | map |
provider | false | string |
schema | true | Object reference to |
table blocks
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 |
|---|---|---|
columns | false | List of object reference to |
table.column
table.column attributes
| Name | Required | Value |
|---|---|---|
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 constraints
| Constraint | Value |
|---|---|
| Required | false |
Require Name (e.g., table.column "name" ) | true |
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 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 |
schema | true | Object reference to |
view constraints
| Constraint | Value |
|---|---|
| Required | false |
Require Name (e.g., view "name" ) | true |
Allow Qualifier (e.g., view "schema" "name" ) | true |