Table
struct TableA loaded table: its metadata, where that metadata came from, and the FileIO its locations resolve through.
Implements Copyable, Movable
- Fields
metadata: TableMetadatametadata_location: Stringio: FileIOname: String
__init__
def __init__(out self, var metadata: TableMetadata, var metadata_location: String, var io: FileIO, var name: String) load
def load(location: String, var io: FileIO) -> Self Load a filesystem table from a directory or a metadata file path.
load_local
def load_local(location: String) -> Self scan
def scan(self) -> TableScan refresh
def refresh(mut self) new_append
def new_append(self) -> AppendFiles Start a fast-append transaction against this table.
append
def append(mut self, batches: List[RecordBatch]) -> Int64 Write batches and commit them as one snapshot. Rows appended.
delete_where
def delete_where(mut self, filter_dsl: String, mode: String = "") -> Int64 DELETE FROM t WHERE <filter>. Returns the rows removed.
The strategy comes from write.delete.mode unless mode overrides
it: copy-on-write (the default) rewrites the affected data files,
merge-on-read writes deletion vectors on v3 and position delete
files on v2.
delete_by_equality
def delete_by_equality(mut self, rows: RecordBatch, equality_ids: List[Int]) -> Int64 Write one equality delete file. Returns the delete rows written.
The rows are values, not positions: every table row whose
equality_ids columns match one of them is gone from then on. v2 and
unpartitioned only — see iceberg.delete.write_equality_deletes.
overwrite
def overwrite(mut self, batches: List[RecordBatch], filter_dsl: String = "[\22true\22]") -> Int64 Delete every row the filter matches and add batches, in one overwrite snapshot. With no filter this replaces the whole table. Returns the rows added.
dynamic_partition_overwrite
def dynamic_partition_overwrite(mut self, batches: List[RecordBatch]) -> Int64 Replace exactly the partitions the new rows land in. Rows added.
expire_snapshots
def expire_snapshots(mut self, older_than_ms: Int64 = Int64(-1), keep_last: Int = Int(1), dry_run: Bool = False) -> ExpireResult Drop old snapshots and the files nothing points at any more.
The pruned metadata is committed first and the files go after, so
an interruption leaves orphans rather than a snapshot with holes in
it. dry_run stops after the decision and returns the list.
update_schema
def update_schema(mut self, update: UpdateSchema) -> Schema Commit schema changes; returns the new current schema.
No data file is touched: one new metadata file with the new schema
appended and made current. A concurrent commit makes this reload and
apply the same changes to whatever schema is current then, so a
column another writer added in the meantime is kept, and a clash
(both adding note) raises instead of committing twice.
commit
def commit(mut self, result: AppendResult) Persist a prepared commit as a new <V>-<uuid>.metadata.json.
commit_metadata
def commit_metadata(mut self, var metadata: TableMetadata) Persist table metadata as a new <V>-<uuid>.metadata.json.
The new file is written with create semantics — it must not already
exist — which is what makes two writers racing on the same version
detectable. A local filesystem really provides that; an object store
does not, and the spec says so, so this is unsafe over s3:// in
exactly the way every other filesystem-table writer is.