unitycatalog.iceberg¶
The classes of the iceberg API.
Classes
| Name | Description |
|---|---|
IcebergBlobMetadata |
A blob of a statistics file. |
IcebergConfigResponse |
The client configuration of a catalog. |
IcebergEncryptedKey |
An encryption key of a table, itself encrypted. |
IcebergListNamespacesResponse |
A page of namespaces. |
IcebergListTablesResponse |
A page of tables: the tables of a namespace that have Iceberg metadata. |
IcebergLoadCredentialsResponse |
Fresh credentials for the files of a table. |
IcebergLoadTableResponse |
The metadata of a table, with the properties a client needs to read and write its files. |
IcebergMetadataLogEntry |
An entry of the metadata log: a previous metadata file. |
IcebergNamespaceResponse |
A namespace and its properties. |
IcebergPartitionField |
A partition field: a transform of a source column. |
IcebergPartitionSpec |
How a table is partitioned. |
IcebergPartitionStatisticsFile |
A file of partition statistics for a snapshot. |
IcebergSchema |
An Iceberg table schema: a struct type with an id. |
IcebergSnapshot |
A snapshot: the state of a table at a point in time. |
IcebergSnapshotLogEntry |
An entry of the snapshot log: when a snapshot became current. |
IcebergSnapshotReference |
A named reference to a snapshot: a branch or a tag. |
IcebergSortField |
A sort field: a transform of a source column and a direction. |
IcebergSortOrder |
How the data files of a table are sorted. |
IcebergStatisticsFile |
A Puffin file of table statistics for a snapshot. |
IcebergStorageCredential |
Credentials for the files below a location prefix. |
IcebergStructField |
A field of a struct type, such as a column of a schema. |
IcebergTableIdentifier |
A table by its namespace and name. |
IcebergTableMetadata |
Iceberg table metadata, in format version 1, 2 or 3. |
IcebergTableRequirement |
A condition that a table must meet for a commit to apply. |
IcebergTableUpdate |
A change to the metadata of a table. |
IcebergUpdateNamespacePropertiesResponse |
The changes of a namespace properties update. |
class unitycatalog.iceberg.IcebergBlobMetadata(*,blob_type: str | None = None,snapshot_id: SupportsIndex | None = None,sequence_number: SupportsIndex | None = None,fields: SupportsGetItem[int, SupportsIndex] | None = None,properties: dict[str, str] | None = None,)¶
A blob of a statistics file.
Attributes
- blob_type (str) – The type of the blob (JSON
type), such asapache-datasketches-theta-v1. - fields (list[int]) – Ids of the fields that the blob was computed from.
- properties (dict[str, str]) – Properties of the blob.
- sequence_number (int) – Sequence number of the snapshot that the blob was computed from.
- snapshot_id (int) – Id of the snapshot that the blob was computed from.
class unitycatalog.iceberg.IcebergConfigResponse¶
The client configuration of a catalog.
Attributes
- defaults (dict[str, str]) – Properties that a client uses unless its own configuration sets them. Always empty.
- endpoints (list[str]) – The routes that the server serves, such as
GET /v1/{prefix}/namespaces. The write routes are in the list only when Iceberg writes are on. - overrides (dict[str, str]) – Properties that replace the client's own configuration:
prefix, the path prefix of the routes of the catalog (catalogs/<catalog>).
class unitycatalog.iceberg.IcebergEncryptedKey(*,key_id: str | None = None,encrypted_key_metadata: str | None = None,encrypted_by_id: str | None = None,properties: dict[str, str] | None = None,)¶
An encryption key of a table, itself encrypted.
Attributes
- encrypted_by_id (str | None) – Id of the key that encrypted this key.
- encrypted_key_metadata (str) – The encrypted key metadata, Base64-encoded.
- key_id (str) – Id of the key.
- properties (dict[str, str]) – Properties of the key.
class unitycatalog.iceberg.IcebergListNamespacesResponse¶
A page of namespaces.
Attributes
- namespaces (list[list[Any]]) – The namespaces, each as the list of its levels: one level, the schema name.
- next_page_token (str | None) – Opaque token of the next page. Absent on the last page and when no page was asked for.
class unitycatalog.iceberg.IcebergListTablesResponse¶
A page of tables: the tables of a namespace that have Iceberg metadata.
Attributes
- identifiers (list[IcebergTableIdentifier]) – The tables.
- next_page_token (str | None) – Opaque token of the next page. Absent on the last page and when no page was asked for.
class unitycatalog.iceberg.IcebergLoadCredentialsResponse¶
Fresh credentials for the files of a table.
Attributes
- storage_credentials (list[IcebergStorageCredential]) – The credentials. Empty for a local table.
class unitycatalog.iceberg.IcebergLoadTableResponse¶
The metadata of a table, with the properties a client needs to read and write its files.
Attributes
- config (dict[str, str]) – FileIO properties for the location of the table: vended credentials under Iceberg's property names, and the endpoint that renews them. Empty for a local table.
- etag (str | None) – Weak tag of the metadata version and the snapshots mode, from the
ETagheader. Only a table load sends it. - metadata (IcebergTableMetadata | None) – The table metadata.
- metadata_location (str | None) – Location of the current metadata file of the table. Absent for a staged create.
class unitycatalog.iceberg.IcebergMetadataLogEntry¶
An entry of the metadata log: a previous metadata file.
Attributes
- metadata_file (str) – Location of the metadata file.
- timestamp_ms (int) – Time at which the metadata file was written, in epoch milliseconds.
class unitycatalog.iceberg.IcebergNamespaceResponse¶
A namespace and its properties.
Attributes
- namespace (list[str]) – The levels of the namespace: one level, the schema name.
- properties (dict[str, str]) – Properties of the namespace.
class unitycatalog.iceberg.IcebergPartitionField(*,source_id: SupportsIndex | None = None,field_id: SupportsIndex | None = None,name: str | None = None,transform: str | None = None,)¶
A partition field: a transform of a source column.
Attributes
- field_id (int) – Id of the partition field. In requests, 0 lets the server assign it.
- name (str) – Name of the partition field.
- source_id (int) – Id of the source column.
- transform (str) – The transform:
identity,year,month,day,hour,void,bucket[N]ortruncate[W].
class unitycatalog.iceberg.IcebergPartitionSpec(*,spec_id: SupportsIndex | None = None,fields: SupportsGetItem[int, IcebergPartitionField] | None = None,)¶
How a table is partitioned.
Attributes
- fields (list[IcebergPartitionField]) – The partition fields. None for an unpartitioned table.
- spec_id (int) – Id of the spec. In requests, the server assigns it.
class unitycatalog.iceberg.IcebergPartitionStatisticsFile(*,snapshot_id: SupportsIndex | None = None,statistics_path: str | None = None,file_size_in_bytes: SupportsIndex | None = None,)¶
A file of partition statistics for a snapshot.
Attributes
- file_size_in_bytes (int) – Size of the file, in bytes.
- snapshot_id (int) – Id of the snapshot that the statistics describe.
- statistics_path (str) – Location of the statistics file.
class unitycatalog.iceberg.IcebergSchema(schema_type: str,fields: SupportsGetItem[int, IcebergStructField],*,schema_id: SupportsIndex | None = None,identifier_field_ids: SupportsGetItem[int, SupportsIndex] | None = None,)¶
An Iceberg table schema: a struct type with an id.
Attributes
- fields (list[IcebergStructField]) – The fields of the schema.
- identifier_field_ids (list[int]) – Ids of the fields that identify a row.
- schema_id (int) – Id of the schema. In requests, the server assigns the ids.
- schema_type (str) – The type of the schema (JSON
type): alwaysstruct.
class unitycatalog.iceberg.IcebergSnapshot(*,snapshot_id: SupportsIndex | None = None,parent_snapshot_id: SupportsIndex | None = None,sequence_number: SupportsIndex | None = None,timestamp_ms: SupportsIndex | None = None,manifest_list: str | None = None,summary: dict[str, str] | None = None,schema_id: SupportsIndex | None = None,first_row_id: SupportsIndex | None = None,added_rows: SupportsIndex | None = None,key_id: str | None = None,)¶
A snapshot: the state of a table at a point in time.
Attributes
- added_rows (int | None) – Number of rows the snapshot adds. Format version 3 only.
- first_row_id (int | None) – First row id of the rows the snapshot adds. Format version 3 only.
- key_id (str | None) – Id of the encryption key of the manifest list. Format version 3 only.
- manifest_list (str) – Location of the manifest list of the snapshot.
- parent_snapshot_id (int | None) – Id of the parent snapshot. Absent for a snapshot without a parent.
- schema_id (int | None) – Id of the current schema when the snapshot was made.
- sequence_number (int) – Sequence number of the snapshot. Absent (0) in format version 1.
- snapshot_id (int) – Id of the snapshot.
- summary (dict[str, str]) – Summary of the changes:
operation(append,replace,overwriteordelete) and other properties. Requests must includeoperation. - timestamp_ms (int) – Time at which the snapshot was made, in epoch milliseconds.
class unitycatalog.iceberg.IcebergSnapshotLogEntry¶
An entry of the snapshot log: when a snapshot became current.
Attributes
- snapshot_id (int) – Id of the snapshot.
- timestamp_ms (int) – Time at which the snapshot became current, in epoch milliseconds.
class unitycatalog.iceberg.IcebergSnapshotReference¶
A named reference to a snapshot: a branch or a tag.
type is branch (with min-snapshots-to-keep, max-snapshot-age-ms and max-ref-age-ms)
or tag (with max-ref-age-ms).
Attributes
- max_ref_age_ms (int | None) – The maximum age of the reference, in milliseconds. The main branch never expires.
- max_snapshot_age_ms (int | None) – Branch only: the maximum age of the snapshots to keep, in milliseconds.
- min_snapshots_to_keep (int | None) – Branch only: the minimum number of snapshots to keep when snapshots expire.
- snapshot_id (int) – Id of the snapshot that the reference points at.
- type (str) – The kind of reference:
branchortag.
class unitycatalog.iceberg.IcebergSortField(*,source_id: SupportsIndex | None = None,transform: str | None = None,direction: str | None = None,null_order: str | None = None,)¶
A sort field: a transform of a source column and a direction.
Attributes
- direction (str) – The direction:
ascordesc. - null_order (str) – Where nulls go:
nulls-firstornulls-last. - source_id (int) – Id of the source column.
- transform (str) – The transform, as in a partition field, such as
identity.
class unitycatalog.iceberg.IcebergSortOrder(*,order_id: SupportsIndex | None = None,fields: SupportsGetItem[int, IcebergSortField] | None = None,)¶
How the data files of a table are sorted.
Attributes
- fields (list[IcebergSortField]) – The sort fields, in order. None for the unsorted order.
- order_id (int) – Id of the sort order. 0 is the unsorted order.
class unitycatalog.iceberg.IcebergStatisticsFile(*,snapshot_id: SupportsIndex | None = None,statistics_path: str | None = None,file_size_in_bytes: SupportsIndex | None = None,file_footer_size_in_bytes: SupportsIndex | None = None,key_metadata: str | None = None,blob_metadata: SupportsGetItem[int, IcebergBlobMetadata] | None = None,)¶
A Puffin file of table statistics for a snapshot.
Attributes
- blob_metadata (list[IcebergBlobMetadata]) – The blobs of the file.
- file_footer_size_in_bytes (int) – Size of the file footer, in bytes.
- file_size_in_bytes (int) – Size of the file, in bytes.
- key_metadata (str | None) – Base64-encoded key metadata of an encrypted file.
- snapshot_id (int) – Id of the snapshot that the statistics describe.
- statistics_path (str) – Location of the statistics file.
class unitycatalog.iceberg.IcebergStorageCredential¶
Credentials for the files below a location prefix.
Attributes
- config (dict[str, str]) – FileIO properties: the credentials under Iceberg's property names.
- prefix (str) – The location prefix that the credentials are for.
class unitycatalog.iceberg.IcebergStructField(id: SupportsIndex,name: str,required: bool,field_type: Any,*,doc: str | None = None,initial_default: Any | None = None,write_default: Any | None = None,)¶
A field of a struct type, such as a column of a schema.
Attributes
- doc (str | None) – Description of the field.
- field_type (Any) – The Iceberg type of the field (JSON
type): a string for a primitive type (long,decimal(10,2),fixed[16]), an object for astruct,listormaptype. - id (int) – Id of the field, unique in the table schema.
- initial_default (Any) – Value of the field in the rows written before the field was added, in Iceberg's JSON form for single values.
- name (str) – Name of the field.
- required (bool) – Whether the field cannot be null.
- write_default (Any) – Value of the field when a writer does not give one, in Iceberg's JSON form for single values.
class unitycatalog.iceberg.IcebergTableIdentifier(namespace: SupportsGetItem[int, str], name: str)¶
A table by its namespace and name.
Attributes
- name (str) – Name of the table.
- namespace (list[str]) – The levels of the namespace: one level, the schema name.
class unitycatalog.iceberg.IcebergTableMetadata¶
Iceberg table metadata, in format version 1, 2 or 3.
Attributes
- current_schema_id (int) – Id of the current schema.
- current_snapshot_id (int | None) – Id of the current snapshot. Absent when the table has no snapshot.
- default_sort_order_id (int) – Id of the default sort order.
- default_spec_id (int) – Id of the default partition spec.
- encryption_keys (list[IcebergEncryptedKey]) – The encryption keys of the table. Format version 3 only.
- format_version (int) – The format version: 1, 2 or 3.
- last_column_id (int) – The highest field id of the table.
- last_partition_id (int) – The highest partition field id of the table.
- last_sequence_number (int) – The highest sequence number of the table. Absent (0) in format version 1.
- last_updated_ms (int) – Time at which the table was last changed, in epoch milliseconds.
- location (str) – Base location of the table.
- metadata_log (list[IcebergMetadataLogEntry]) – The previous metadata files.
- next_row_id (int | None) – The next row id to assign. Format version 3 only.
- partition_spec (list[IcebergPartitionField]) – Format version 1 only: the fields of the default partition spec.
- partition_specs (list[IcebergPartitionSpec]) – The partition specs of the table.
- partition_statistics (list[IcebergPartitionStatisticsFile]) – The partition statistics files.
- properties (dict[str, str]) – Properties of the table.
- refs (dict[str, IcebergSnapshotReference]) – The branches and tags of the table, by name. Absent in format version 1.
- schema (IcebergSchema | None) – Format version 1 only: the current schema.
- schemas (list[IcebergSchema]) – The schemas of the table.
- snapshot_log (list[IcebergSnapshotLogEntry]) – When each snapshot became current.
- snapshots (list[IcebergSnapshot]) – The snapshots of the table. With
snapshots=refs, only those that a reference points at. - sort_orders (list[IcebergSortOrder]) – The sort orders of the table.
- statistics (list[IcebergStatisticsFile]) – The table statistics files.
- table_uuid (str) – UUID of the table.
class unitycatalog.iceberg.IcebergTableRequirement(*,requirement_type: str | None = None,uuid: str | None = None,ref_name: str | None = None,snapshot_id: SupportsIndex | None = None,last_assigned_field_id: SupportsIndex | None = None,current_schema_id: SupportsIndex | None = None,last_assigned_partition_id: SupportsIndex | None = None,default_spec_id: SupportsIndex | None = None,default_sort_order_id: SupportsIndex | None = None,)¶
A condition that a table must meet for a commit to apply.
type (requirement_type) picks the condition and its field:
- assert-create: the table does not exist (no field). The commit creates a staged table.
- assert-table-uuid: uuid.
- assert-ref-snapshot-id: ref (ref_name) and snapshot-id; without snapshot-id the
reference must not exist.
- assert-last-assigned-field-id: last-assigned-field-id.
- assert-current-schema-id: current-schema-id.
- assert-last-assigned-partition-id: last-assigned-partition-id.
- assert-default-spec-id: default-spec-id.
- assert-default-sort-order-id: default-sort-order-id.
Attributes
- current_schema_id (int | None) –
assert-current-schema-id: id of the current schema. - default_sort_order_id (int | None) –
assert-default-sort-order-id: id of the default sort order. - default_spec_id (int | None) –
assert-default-spec-id: id of the default partition spec. - last_assigned_field_id (int | None) –
assert-last-assigned-field-id: the highest field id of the table. - last_assigned_partition_id (int | None) –
assert-last-assigned-partition-id: the highest partition field id of the table. - ref_name (str | None) –
assert-ref-snapshot-id: name of the branch or tag (JSONref). - requirement_type (str) – The kind of condition (JSON
type), such asassert-current-schema-id. - snapshot_id (int | None) –
assert-ref-snapshot-id: the snapshot that the reference points at. - uuid (str | None) –
assert-table-uuid: the UUID of the table.
class unitycatalog.iceberg.IcebergTableUpdate(*,action: str | None = None,format_version: SupportsIndex | None = None,uuid: str | None = None,schema: IcebergSchema | None = None,schema_id: SupportsIndex | None = None,spec: IcebergPartitionSpec | None = None,spec_id: SupportsIndex | None = None,sort_order: IcebergSortOrder | None = None,sort_order_id: SupportsIndex | None = None,snapshot: IcebergSnapshot | None = None,ref_name: str | None = None,snapshot_id: SupportsIndex | None = None,ref_type: str | None = None,min_snapshots_to_keep: SupportsIndex | None = None,max_snapshot_age_ms: SupportsIndex | None = None,max_ref_age_ms: SupportsIndex | None = None,snapshot_ids: SupportsGetItem[int, SupportsIndex] | None = None,location: str | None = None,updates: dict[str, str] | None = None,removals: SupportsGetItem[int, str] | None = None,spec_ids: SupportsGetItem[int, SupportsIndex] | None = None,statistics: IcebergStatisticsFile | None = None,partition_statistics: IcebergPartitionStatisticsFile | None = None,schema_ids: SupportsGetItem[int, SupportsIndex] | None = None,encryption_key: IcebergEncryptedKey | None = None,key_id: str | None = None,)¶
A change to the metadata of a table.
action picks the change and its fields:
- upgrade-format-version: format-version.
- assign-uuid: uuid.
- add-schema: schema.
- set-current-schema: schema-id (-1 for the schema added last).
- add-spec: spec.
- set-default-spec: spec-id (-1 for the spec added last).
- add-sort-order: sort-order.
- set-default-sort-order: sort-order-id (-1 for the sort order added last).
- add-snapshot: snapshot.
- set-snapshot-ref: ref-name, snapshot-id, type (ref_type) and the retention fields
of a branch (min-snapshots-to-keep, max-snapshot-age-ms, max-ref-age-ms) or a tag
(max-ref-age-ms).
- remove-snapshots: snapshot-ids.
- remove-snapshot-ref: ref-name.
- set-location: location.
- set-properties: updates.
- remove-properties: removals.
- remove-partition-specs: spec-ids.
- set-statistics: statistics, and optionally snapshot-id (that of the statistics).
- remove-statistics: snapshot-id.
- set-partition-statistics: partition-statistics.
- remove-partition-statistics: snapshot-id.
- remove-schemas: schema-ids.
- add-encryption-key: encryption-key.
- remove-encryption-key: key-id.
The lists and the map are always sent, empty for the other actions; the server ignores the
keys that an action does not read.
Attributes
- action (str) – The kind of change, such as
add-snapshot. - encryption_key (IcebergEncryptedKey | None) –
add-encryption-key: the encryption key to add. - format_version (int | None) –
upgrade-format-version: the format version to upgrade to. - key_id (str | None) –
remove-encryption-key: id of the encryption key to remove. - location (str | None) –
set-location: the new base location of the table. - max_ref_age_ms (int | None) –
set-snapshot-ref: the maximum age of the reference, in milliseconds. - max_snapshot_age_ms (int | None) –
set-snapshot-ref, branch only: the maximum age of the snapshots to keep, in milliseconds. - min_snapshots_to_keep (int | None) –
set-snapshot-ref, branch only: the minimum number of snapshots to keep when snapshots expire. - partition_statistics (IcebergPartitionStatisticsFile | None) –
set-partition-statistics: the partition statistics file to set. - ref_name (str | None) –
set-snapshot-refandremove-snapshot-ref: name of the branch or tag. - ref_type (str | None) –
set-snapshot-ref: the kind of reference (JSONtype),branchortag. - removals (list[str]) –
remove-properties: keys of the properties to remove. - schema (IcebergSchema | None) –
add-schema: the schema to add. - schema_id (int | None) –
set-current-schema: id of the schema to make current, or -1 for the schema added last. - schema_ids (list[int]) –
remove-schemas: ids of the schemas to remove. - snapshot (IcebergSnapshot | None) –
add-snapshot: the snapshot to add. - snapshot_id (int | None) –
set-snapshot-ref: the snapshot that the reference points at.set-statistics,remove-statisticsandremove-partition-statistics: the snapshot of the statistics. - snapshot_ids (list[int]) –
remove-snapshots: ids of the snapshots to remove. - sort_order (IcebergSortOrder | None) –
add-sort-order: the sort order to add. - sort_order_id (int | None) –
set-default-sort-order: id of the sort order to make the default, or -1 for the sort order added last. - spec (IcebergPartitionSpec | None) –
add-spec: the partition spec to add. - spec_id (int | None) –
set-default-spec: id of the spec to make the default, or -1 for the spec added last. - spec_ids (list[int]) –
remove-partition-specs: ids of the partition specs to remove. - statistics (IcebergStatisticsFile | None) –
set-statistics: the statistics file to set. - updates (dict[str, str]) –
set-properties: the properties to set. - uuid (str | None) –
assign-uuid: the new UUID of the table.
class unitycatalog.iceberg.IcebergUpdateNamespacePropertiesResponse¶
The changes of a namespace properties update.
Attributes
- missing (list[str]) – Keys to remove that the namespace did not have.
- removed (list[str]) – Keys that were removed.
- updated (list[str]) – Keys that were set.