Skip to content

Table

laktory.models.resources.databricks.Table ¤

Bases: UnityCatalogMixin, TableBase

A table resides in the third layer of Unity Catalog’s three-level namespace. It contains rows of data.

Examples:

import io

from laktory import models

table_yaml = '''
name: slv_stock_prices
catalog_name: dev
schema_name: finance
table_type: MANAGED
grants:
- principal: account users
  privileges:
  - SELECT
'''
table = models.resources.databricks.Table.model_validate_yaml(
    io.StringIO(table_yaml)
)
References
BASE DESCRIPTION
catalog_name

Name of parent catalog. Change forces the creation of a new resource

TYPE: str | VariableType | None DEFAULT: None

cluster_id

All table CRUD operations must be executed on a running cluster or SQL warehouse. If a cluster_id is specified, it will be used to execute SQL commands to manage this table. If empty, a cluster will be created automatically with the name terraform-sql-table. Conflicts with warehouse_id

TYPE: str | None | VariableType DEFAULT: None

cluster_keys

a subset of columns to liquid cluster the table by. For automatic clustering, set cluster_keys to ['AUTO']. To turn off clustering, set it to ['NONE']. Conflicts with partitions

TYPE: list[str] | None | VariableType DEFAULT: None

column

TYPE: list[TableColumn] | None | VariableType DEFAULT: None

comment

User-supplied free-form text

TYPE: str | None | VariableType DEFAULT: None

data_source_format

External tables are supported in multiple data source formats. The string constants identifying these formats are DELTA, CSV, JSON, AVRO, PARQUET, ORC, and TEXT. Change forces the creation of a new resource. Not supported for MANAGED tables or VIEW

TYPE: str | None | VariableType DEFAULT: None

name

User-visible name of column

TYPE: str | VariableType

options

Map of user defined table options. Change forces creation of a new resource

TYPE: dict[str, str] | None | VariableType DEFAULT: None

owner

User name/group name/sp application_id of the table owner

TYPE: str | None | VariableType DEFAULT: None

partitions

a subset of columns to partition the table by. Change forces the creation of a new resource. Conflicts with cluster_keys

TYPE: list[str] | None | VariableType DEFAULT: None

properties

A map of table properties

TYPE: dict[str, str] | None | VariableType DEFAULT: None

schema_name

Name of parent Schema relative to parent Catalog. Change forces the creation of a new resource

TYPE: str | VariableType | None DEFAULT: None

storage_credential_name

For EXTERNAL Tables only: the name of storage credential to use. Change forces the creation of a new resource

TYPE: str | None | VariableType DEFAULT: None

storage_location

URL of storage location for Table data (required for EXTERNAL Tables). If the URL contains special characters, such as space, &, etc., they should be percent-encoded (space -> %20, etc.). Not supported for VIEW or MANAGED table_type

TYPE: str | None | VariableType DEFAULT: None

table_type

Distinguishes a view vs. managed/external Table. MANAGED, EXTERNAL or VIEW. Change forces the creation of a new resource

TYPE: str | VariableType

view_definition

SQL text defining the view (for table_type == 'VIEW'). Not supported for MANAGED or EXTERNAL table_type

TYPE: str | None | VariableType DEFAULT: None

warehouse_id

All table CRUD operations must be executed on a running cluster or SQL warehouse. If a warehouse_id is specified, that SQL warehouse will be used to execute SQL commands to manage this table. Conflicts with cluster_id

TYPE: str | None | VariableType DEFAULT: None

LAKTORY DESCRIPTION
grant

Non-destructive grant for specific principal(s). Adds or updates privileges for the listed principal(s) and leaves grants for all other principals untouched. Use when access is managed from multiple sources (Laktory, Databricks UI, etc.). Mutually exclusive with grants.

TYPE: TableGrant | list[TableGrant] | VariableType DEFAULT: None

grants

Authoritative grant list for all principals. Replaces every existing grant on this Table - including those set outside Laktory - with only the entries listed here. Use only when Laktory owns all access management for this resource. Mutually exclusive with grant.

TYPE: list[TableGrant | VariableType] | VariableType DEFAULT: None

ATTRIBUTE DESCRIPTION
additional_core_resources
  • table grants

TYPE: list

column_names

List of column names

TYPE: list[str]

full_name

Table full name {catalog_name}.{schema_name}.{table_name}

TYPE: str

is_from_cdc

If True CDC source is used to build the table

TYPE: bool

parent_full_name

Parent namespace in the UC three-level hierarchy

TYPE: str | None

additional_core_resources property ¤

  • table grants

column_names property ¤

List of column names

full_name property ¤

Table full name {catalog_name}.{schema_name}.{table_name}

is_from_cdc property ¤

If True CDC source is used to build the table

parent_full_name property ¤

Parent namespace in the UC three-level hierarchy


laktory.models.resources.databricks.table.TableColumn ¤

Bases: BaseModel

PARAMETER DESCRIPTION
comment

User-supplied free-form text

TYPE: str | None | VariableType DEFAULT: None

identity

Whether the field is an identity column. Can be default, always, or unset. It is unset by default

TYPE: str | None | VariableType DEFAULT: None

name

User-visible name of column

TYPE: str | VariableType

nullable

Whether field is nullable (Default: true)

TYPE: bool | None | VariableType DEFAULT: None

type

Column type spec (with metadata) as SQL text. Not supported for VIEW table_type

TYPE: str | None | VariableType DEFAULT: None

type_json

TYPE: str | None | VariableType DEFAULT: None


laktory.models.resources.databricks.table.TableLookup ¤

Bases: ResourceLookup

PARAMETER DESCRIPTION
name

Full name of the databricks_table: catalog.schema.table

TYPE: str | VariableType