Skip to content

yggdrasil.databricks.column

column

Unity Catalog column resource + service.

Column

Column(table: 'Table', name: str, field: Field)

entity_name property

entity_name: str

Fully-qualified entity_name for the entity_tag_assignments API.

tags property

tags: tuple

Column-level entity-tag assignments — served from client.entity_tags.

set_tags

set_tags(
    tags: Mapping[str, str] | None,
    *,
    tag_collation: str | None = DEFAULT_TAG_COLLATION
)

Apply column-level tags via the UC entity_tag_assignments API.

tag_collation is accepted for API compatibility and ignored — collations only matter for the legacy DDL literal form.

unset_tags

unset_tags(tag_keys: Iterable[str], *, if_exists: bool = True)

Delete column-level tag assignments by key.

rename

rename(new_name: str) -> 'Column'

Rename this column in-place (ALTER TABLE … RENAME COLUMN …).

Columns

Columns(
    client=None,
    catalog_name: str | None = None,
    schema_name: str | None = None,
    table_name: str | None = None,
    column_name: str | None = None,
)

Bases: DatabricksService

Collection-level service for Unity Catalog columns.

Carry default catalog / schema / table / column context so callers do not have to repeat them on every call::

cols = client.columns(catalog_name="main", schema_name="sales", table_name="orders")
col  = cols.column("price")
for c in cols.list_columns():
    print(c.name)

wheels property

wheels: 'Wheels'

Wheel registry service (shorthand for client.wheels).

environments property

environments: 'Environments'

Base-environment service (shorthand for client.environments).

tables property

tables: 'Tables'

Collection-level Unity Catalog table service (shorthand for client.tables).

views property

views: 'Tables'

Alias for :attr:tables — :class:Table covers both managed/external tables and view-shaped securables.

catalogs property

catalogs: 'Catalogs'

Collection-level Unity Catalog hierarchy service (shorthand for client.catalogs).

schemas property

schemas: 'Schemas'

Collection-level Unity Catalog schema service (shorthand for client.schemas).

volumes property

volumes: 'Volumes'

Collection-level Unity Catalog volume service (shorthand for client.volumes).

genie property

genie: 'Genie'

Genie service (shorthand for client.genie).

ai property

ai: 'DatabricksAI'

Databricks AI umbrella service (shorthand for client.ai).

default_tags

default_tags(update: bool = True) -> dict[str, str]

Return default resource tags for Databricks assets.

Returns:

Type Description
dict[str, str]

A dict of default tags.

parse_location

parse_location(
    location: str,
) -> tuple[Optional[str], Optional[str], Optional[str], Optional[str]]

Parse a dotted location into (catalog, schema, table, column).

Supported forms (backtick-quoted parts are stripped):

========================================== ============================================= Input Result ========================================== ============================================= "price" (self.catalog, self.schema, self.table, "price") "orders.price" (self.catalog, self.schema, "orders", "price") "sales.orders.price" (self.catalog, "sales", "orders", "price") "main.sales.orders.price" ("main", "sales", "orders", "price") ========================================== =============================================

Excess leading parts are dropped — only the rightmost four are used.

column

column(
    location: str | None = None,
    *,
    catalog_name: str | None = None,
    schema_name: str | None = None,
    table_name: str | None = None,
    column_name: str | None = None
) -> "Column"

Resolve and return a single :class:~yggdrasil.databricks.column.column.Column.

Parameters:

Name Type Description Default
location str | None

Dotted name ("catalog.schema.table.col" or fewer parts).

None
catalog_name str | None

Override catalog (falls back to service default).

None
schema_name str | None

Override schema (falls back to service default).

None
table_name str | None

Override table (falls back to service default).

None
column_name str | None

Override column name (falls back to last location part).

None

Returns:

Type Description
'Column'

The resolved :class:Column.

Raises:

Type Description
AssertionError

When any of catalog / schema / table is missing.

ValueError

When the column does not exist in the table.

list_columns

list_columns(
    location: str | None = None,
    *,
    catalog_name: str | None = None,
    schema_name: str | None = None,
    table_name: str | None = None
) -> list["Column"]

Return all columns for a table.

Parameters:

Name Type Description Default
location str | None

Dotted name (table or schema.table or fully qualified).

None
catalog_name str | None

Override catalog.

None
schema_name str | None

Override schema.

None
table_name str | None

Override table.

None

Returns:

Type Description
list['Column']

List of :class:Column objects in schema-definition order.