Skip to content

unitycatalog.tables

The classes of the tables API.

Classes

Name Description
ColumnInfo A column of a table.
Dependency A dependency of a view or function. Exactly one of the fields is set.
DependencyList The dependencies of a view or function.
FunctionDependency A function that a view or function depends on.
ListTablesResponse  
StagingTableInfo A staging table: a table id and managed storage location reserved for a MANAGED table that a client is about to create.
TableClient The requests on one TableInfo.
TableDependency A table that a view or function depends on.
TableInfo A table: data in the third layer of the three-level namespace, below a schema.
UpdateColumn A new comment for a column of a table.

Enums

Name Description
ColumnTypeName The name of the data type of a column.
DataSourceFormat The file format of the data of a table.
TableType The type of a table.

class unitycatalog.tables.ColumnInfo(name: str,type_json: str,*,type_text: str | None = None,type_name: ColumnTypeName | str | None = None,type_precision: SupportsIndex | None = None,type_scale: SupportsIndex | None = None,type_interval_type: str | None = None,position: SupportsIndex | None = None,comment: str | None = None,nullable: bool | None = None,partition_index: SupportsIndex | None = None,)

A column of a table.

Attributes

  • comment (str | None) – User-provided free-form text description.
  • name (str) – Name of the column.
  • nullable (bool | None) – Whether the column can hold null values. The server sets false when it is absent.
  • partition_index (int | None) – Position of the column in the partition key of the table.
  • position (int | None) – Position of the column, starting at 0.
  • type_interval_type (str | None) – Format of an interval type.
  • type_json (str) – Full data type of the column as a JSON Spark StructField.
  • type_name (ColumnTypeName | None) – Name of the data type of the column.
  • type_precision (int | None) – Digits of precision. Required for decimal types.
  • type_scale (int | None) – Digits to the right of the decimal point. Required for decimal types.
  • type_text (str | None) – Full data type of the column as SQL text, such as decimal(10,2).

class unitycatalog.tables.Dependency(*,table: TableDependency | None = None,function: FunctionDependency | None = None,)

A dependency of a view or function. Exactly one of the fields is set.

Attributes

class unitycatalog.tables.DependencyList(*, dependencies: SupportsGetItem[int, Dependency] | None = None)

The dependencies of a view or function.

Attributes

  • dependencies (list[Dependency]) – The dependencies.

class unitycatalog.tables.FunctionDependency(function_full_name: str)

A function that a view or function depends on.

Attributes

  • function_full_name (str) – Full name of the function, in the form <catalog>.<schema>.<function>.

class unitycatalog.tables.ListTablesResponse

Attributes

  • next_page_token (str | None) – Opaque token of the next page. Absent on the last page.
  • tables (list[TableInfo]) – The tables.

class unitycatalog.tables.StagingTableInfo

A staging table: a table id and managed storage location reserved for a MANAGED table that a client is about to create.

Attributes

  • catalog_name (str) – Name of the parent catalog.
  • id (str) – Unique identifier of the staging table. The table gets it when it is created.
  • name (str) – Name of the table, relative to the parent schema.
  • schema_name (str) – Name of the parent schema.
  • staging_location (str) – Storage location URL reserved for the table. Create the table with it as its storage_location.

class unitycatalog.tables.TableClient

The requests on one TableInfo.

delete() → None

Delete a table.

Async: delete_async(…) → Future[None]

get(*,read_streaming_table_as_managed: bool | None = None,read_materialized_view_as_managed: bool | None = None,include_browse: bool | None = None,) → TableInfo

Get a table.

Parameters

  • read_streaming_table_as_managed (bool | None, optional) – Show a streaming table as a MANAGED table, as upstream's server can. This server does not read it.
  • read_materialized_view_as_managed (bool | None, optional) – Show a materialized view as a MANAGED table, as upstream's server can. This server does not read it.
  • include_browse (bool | None, optional) – Also answer a caller who sees the table through the BROWSE privilege only, with its discovery fields and browse_only set.

Returns

  • TableInfo – A table: data in the third layer of the three-level namespace, below a schema.

Async: get_async(…) → Future[TableInfo]

update(*,comment: str | None = None,columns: SupportsGetItem[int, UpdateColumn] | None = None,) → TableInfo

Change the comments of a table and its columns.

Parameters

  • comment (str | None, optional) – User-provided free-form text description.
  • columns (SupportsGetItem[int, UpdateColumn] | None, optional) – Columns that get a new comment; the others keep theirs.

Returns

  • TableInfo – A table: data in the third layer of the three-level namespace, below a schema.

Async: update_async(…) → Future[TableInfo]

class unitycatalog.tables.TableDependency(table_full_name: str)

A table that a view or function depends on.

Attributes

  • table_full_name (str) – Full name of the table, in the form <catalog>.<schema>.<table>.

class unitycatalog.tables.TableInfo

A table: data in the third layer of the three-level namespace, below a schema.

Attributes

  • browse_only (bool | None) – True when the table has only the discovery fields that the BROWSE privilege allows.
  • catalog_name (str) – Name of the parent catalog.
  • columns (list[ColumnInfo]) – The columns of the table.
  • comment (str | None) – User-provided free-form text description.
  • created_at (int) – Time at which the table was created, in epoch milliseconds.
  • created_by (str | None) – Username of the creator of the table.
  • data_source_format (DataSourceFormat | None) – File format of the data of the table.
  • name (str) – Name of the table, relative to the parent schema.
  • owner (str | None) – Username of the owner of the table.
  • properties (dict[str, str]) – Key-value properties of the table.
  • schema_name (str) – Name of the parent schema.
  • storage_location (str | None) – Storage location URL of the table. Absent for views.
  • table_id (str) – Unique identifier of the table.
  • table_type (TableType | None) – Type of the table.
  • updated_at (int) – Time at which the table was last changed, in epoch milliseconds.
  • updated_by (str | None) – Username of the user who last changed the table.
  • view_definition (str | None) – Definition of a view-like table: SQL for views, YAML for metric views.
  • view_dependencies (DependencyList | None) – The tables and functions that a view-like table reads.

class unitycatalog.tables.UpdateColumn(name: str, comment: str)

A new comment for a column of a table.

Attributes

  • comment (str) – New comment of the column. Empty clears it.
  • name (str) – Name of the column.

class unitycatalog.tables.ColumnTypeName

The name of the data type of a column.

Members

  • BOOLEAN
  • BYTE
  • SHORT
  • INT
  • LONG
  • FLOAT
  • DOUBLE
  • DATE
  • TIMESTAMP
  • TIMESTAMP_NTZ – Timestamp without a time zone.
  • STRING
  • BINARY
  • DECIMAL
  • INTERVAL
  • ARRAY
  • STRUCT
  • MAP
  • VARIANT
  • CHAR
  • NULL
  • USER_DEFINED_TYPE
  • TABLE_TYPE – The return type of a table function.

class unitycatalog.tables.DataSourceFormat

The file format of the data of a table.

Members

  • DELTA
  • ICEBERG
  • CSV
  • JSON
  • AVRO
  • PARQUET
  • ORC
  • TEXT
  • LANCE – A Lance dataset. Upstream's API has no LANCE.

class unitycatalog.tables.TableType

The type of a table.

Members

  • MANAGED – A table whose data Unity Catalog manages, below the managed storage of its schema or catalog.
  • EXTERNAL – A table whose data is at a storage location that the user gives.
  • STREAMING_TABLE – A streaming table.
  • MATERIALIZED_VIEW – A materialized view.
  • METRIC_VIEW – A metric view: its definition is YAML.
  • VIEW – A view: its definition is SQL.