pub struct Table { /* private fields */ }
Expand description
Iceberg table
Implementations§
Source§impl Table
Public interface of the table.
impl Table
Public interface of the table.
Sourcepub fn builder() -> CreateTableBuilder
pub fn builder() -> CreateTableBuilder
Creates a new table builder with default configuration
Returns a CreateTableBuilder
initialized with default properties:
- WRITE_PARQUET_COMPRESSION_CODEC: “zstd”
- WRITE_PARQUET_COMPRESSION_LEVEL: “1”
- WRITE_OBJECT_STORAGE_ENABLED: “false”
§Returns
CreateTableBuilder
- A builder for configuring and creating a new table
§Example
use iceberg_rust::table::Table;
let builder = Table::builder()
.with_name("my_table")
.with_schema(schema);
Sourcepub async fn new(
identifier: Identifier,
catalog: Arc<dyn Catalog>,
metadata: TableMetadata,
) -> Result<Self, Error>
pub async fn new( identifier: Identifier, catalog: Arc<dyn Catalog>, metadata: TableMetadata, ) -> Result<Self, Error>
Creates a new table instance with the given identifier, catalog and metadata
§Arguments
identifier
- The unique identifier for this table in the catalogcatalog
- The catalog that this table belongs tometadata
- The table’s metadata containing schema, partitioning, etc.
§Returns
Result<Table, Error>
- The newly created table instance or an error
This is typically called by catalog implementations rather than directly by users.
For creating new tables, use Table::builder()
instead.
Sourcepub fn identifier(&self) -> &Identifier
pub fn identifier(&self) -> &Identifier
Returns the unique identifier for this table in the catalog
The identifier contains both the namespace and name that uniquely identify this table within its catalog.
§Returns
&Identifier
- A reference to this table’s identifier
Sourcepub fn catalog(&self) -> Arc<dyn Catalog>
pub fn catalog(&self) -> Arc<dyn Catalog>
Returns a reference to the catalog containing this table
The returned catalog reference is wrapped in an Arc to allow shared ownership and thread-safe access to the catalog implementation.
§Returns
Arc<dyn Catalog>
- A thread-safe reference to the table’s catalog
Sourcepub fn object_store(&self) -> Arc<dyn ObjectStore>
pub fn object_store(&self) -> Arc<dyn ObjectStore>
Returns the object store for this table’s location
The object store is determined by the table’s location and is used for reading and writing table data files. The returned store is wrapped in an Arc to allow shared ownership and thread-safe access.
§Returns
Arc<dyn ObjectStore>
- A thread-safe reference to the table’s object store
Sourcepub fn current_schema(&self, branch: Option<&str>) -> Result<&Schema, Error>
pub fn current_schema(&self, branch: Option<&str>) -> Result<&Schema, Error>
Returns the current schema for this table, optionally for a specific branch
§Arguments
branch
- Optional branch name to get the schema for. If None, returns the main branch schema
§Returns
Result<&Schema, Error>
- The current schema if found, or an error if the schema cannot be found
§Errors
Returns an error if the schema ID cannot be found in the table metadata
Sourcepub fn metadata(&self) -> &TableMetadata
pub fn metadata(&self) -> &TableMetadata
Returns a reference to this table’s metadata
The metadata contains all table information including:
- Schema definitions
- Partition specifications
- Snapshots
- Sort orders
- Table properties
§Returns
&TableMetadata
- A reference to the table’s metadata
Sourcepub fn into_metadata(self) -> TableMetadata
pub fn into_metadata(self) -> TableMetadata
Consumes the table and returns its metadata
This method takes ownership of the table instance and returns just the underlying TableMetadata. This is useful when you no longer need the table instance but want to retain its metadata.
§Returns
TableMetadata
- The owned metadata from this table
Sourcepub async fn manifests(
&self,
start: Option<i64>,
end: Option<i64>,
) -> Result<Vec<ManifestListEntry>, Error>
pub async fn manifests( &self, start: Option<i64>, end: Option<i64>, ) -> Result<Vec<ManifestListEntry>, Error>
Returns manifest list entries for snapshots within the given sequence range
§Arguments
start
- Optional starting snapshot ID (exclusive). If None, includes from the beginningend
- Optional ending snapshot ID (inclusive). If None, uses the current snapshot
§Returns
Result<Vec<ManifestListEntry>, Error>
- Vector of manifest entries in the range, or an empty vector if no current snapshot exists
§Errors
Returns an error if:
- The end snapshot ID is invalid
- Reading the manifest list fails
Sourcepub async fn datafiles<'a>(
&self,
manifests: &'a [ManifestListEntry],
filter: Option<Vec<bool>>,
sequence_number_range: (Option<i64>, Option<i64>),
) -> Result<impl Stream<Item = Result<ManifestEntry, Error>> + 'a, Error>
pub async fn datafiles<'a>( &self, manifests: &'a [ManifestListEntry], filter: Option<Vec<bool>>, sequence_number_range: (Option<i64>, Option<i64>), ) -> Result<impl Stream<Item = Result<ManifestEntry, Error>> + 'a, Error>
Returns a stream of manifest entries for the given manifest list entries
§Arguments
manifests
- List of manifest entries to read data files fromfilter
- Optional vector of boolean predicates to filter manifest entriessequence_number_range
- Tuple of (start, end) sequence numbers to filter entries by
§Returns
Result<impl Stream<Item = Result<ManifestEntry, Error>>, Error>
- Stream of manifest entries that match the given filters
§Type Parameters
'a
- Lifetime of the manifest list entries reference
§Errors
Returns an error if reading any manifest file fails
Sourcepub async fn datafiles_contains_delete(
&self,
start: Option<i64>,
end: Option<i64>,
) -> Result<bool, Error>
pub async fn datafiles_contains_delete( &self, start: Option<i64>, end: Option<i64>, ) -> Result<bool, Error>
Check if datafiles contain deletes
Sourcepub fn new_transaction(&mut self, branch: Option<&str>) -> TableTransaction<'_>
pub fn new_transaction(&mut self, branch: Option<&str>) -> TableTransaction<'_>
Creates a new transaction for atomic modifications to this table
§Arguments
branch
- Optional branch name to create the transaction for. If None, uses the main branch
§Returns
TableTransaction
- A new transaction that can be used to atomically modify this table
The transaction must be committed for any changes to take effect. Multiple operations can be chained within a single transaction.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Table
impl !RefUnwindSafe for Table
impl Send for Table
impl Sync for Table
impl Unpin for Table
impl !UnwindSafe for Table
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more