pub struct View { /* private fields */ }
Expand description
An Iceberg view provides a logical view over underlying data with schema evolution and versioning
Views store:
- SQL query or other representation of the view logic
- Schema evolution history
- Version history for view definitions
- Properties for configuration
- Metadata about view location and catalog
Views can be either filesystem-based or managed by a metastore catalog. They support transactions for atomic updates to their definition and properties.
The View struct provides the main interface for:
- Creating and managing views
- Accessing view metadata and schemas
- Starting transactions for atomic updates
- Interacting with the underlying storage system
Implementations§
Source§impl View
Public interface of the table.
impl View
Public interface of the table.
Sourcepub fn builder() -> CreateViewBuilder<Option<()>>
pub fn builder() -> CreateViewBuilder<Option<()>>
Creates a new builder for configuring and creating an Iceberg view
Returns a CreateViewBuilder
that provides a fluent interface for:
- Setting the view name and location
- Configuring view properties
- Defining the view schema
- Setting SQL or other view representations
- Specifying the catalog and namespace
§Returns
CreateViewBuilder<Option<()>>
- A builder for creating new views
Sourcepub async fn new(
identifier: Identifier,
catalog: Arc<dyn Catalog>,
metadata: ViewMetadata,
) -> Result<Self, Error>
pub async fn new( identifier: Identifier, catalog: Arc<dyn Catalog>, metadata: ViewMetadata, ) -> Result<Self, Error>
Creates a new Iceberg view instance with the given identifier, catalog and metadata
§Arguments
identifier
- The unique identifier for this view in the catalogcatalog
- The catalog that will manage this viewmetadata
- The view metadata containing schema, versions, and other view information
§Returns
Result<Self, Error>
- The new view instance or an error if creation fails
This is typically called by catalog implementations rather than directly by users.
For creating new views, use the builder()
method instead.
Sourcepub fn identifier(&self) -> &Identifier
pub fn identifier(&self) -> &Identifier
Gets the unique identifier for this view in the catalog
The identifier contains:
- The namespace path for the view
- The view name
§Returns
&Identifier
- A reference to this view’s identifier
Sourcepub fn catalog(&self) -> Arc<dyn Catalog>
pub fn catalog(&self) -> Arc<dyn Catalog>
Gets the catalog that manages this view
The catalog handles:
- View metadata storage and retrieval
- Schema management
- View versioning
- Access control
§Returns
Arc<dyn Catalog>
- A thread-safe reference to the catalog
Sourcepub fn object_store(&self) -> Arc<dyn ObjectStore>
pub fn object_store(&self) -> Arc<dyn ObjectStore>
Gets the object store for this view’s storage location
The object store provides:
- Access to the underlying storage system (S3, local filesystem, etc)
- Read/write operations for view data and metadata
- Storage-specific configuration and credentials
§Returns
Arc<dyn ObjectStore>
- A thread-safe reference to the configured object store
Sourcepub fn current_schema(&self, branch: Option<&str>) -> Result<&Schema, Error>
pub fn current_schema(&self, branch: Option<&str>) -> Result<&Schema, Error>
Gets the current schema for this view, 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 for the view/branch, or an error if not found
The schema defines the structure of the view’s output, including:
- Column names and types
- Column IDs and documentation
- Whether columns are required/optional
Sourcepub fn metadata(&self) -> &ViewMetadata
pub fn metadata(&self) -> &ViewMetadata
Gets the underlying view metadata that defines this view
The metadata contains:
- View UUID and format version
- Storage location information
- Version history and schema evolution
- View properties and configurations
- SQL representations and other view definitions
§Returns
&ViewMetadata
- A reference to the view’s metadata
Sourcepub fn new_transaction(&mut self, branch: Option<&str>) -> ViewTransaction<'_>
pub fn new_transaction(&mut self, branch: Option<&str>) -> ViewTransaction<'_>
Creates a new transaction for performing atomic updates to this view
§Arguments
branch
- Optional branch name to create the transaction for. If None, uses the main branch
§Returns
ViewTransaction
- A new transaction that can be used to:- Update view representations and schemas
- Modify view properties
- Commit changes atomically
Transactions ensure that all changes are applied atomically with ACID guarantees. Multiple operations can be chained and will be committed together.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for View
impl !RefUnwindSafe for View
impl Send for View
impl Sync for View
impl Unpin for View
impl !UnwindSafe for View
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