File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
crates/iceberg/src/transaction Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 1616// under the License.
1717
1818//! This module contains transaction api.
19+ //!
20+ //! The transaction API enables changes to be made to an existing table.
21+ //!
22+ //! Note that this may also have side effects, such as producing new manifest
23+ //! files.
24+ //!
25+ //! Below is a basic example using the "fast-append" action:
26+ //!
27+ //! ```ignore
28+ //! use iceberg::transaction::{ApplyTransactionAction, Transaction};
29+ //! use iceberg::Catalog;
30+ //!
31+ //! // Create a transaction.
32+ //! let tx = Transaction::new(my_table);
33+ //!
34+ //! // Create a `FastAppendAction` which will not rewrite or append
35+ //! // to existing metadata. This will create a new manifest.
36+ //! let action = tx.fast_append().add_data_files(my_data_files);
37+ //!
38+ //! // Apply the fast-append action to the given transaction, returning
39+ //! // the newly updated `Transaction`.
40+ //! let tx = action.apply(tx).unwrap();
41+ //!
42+ //!
43+ //! // End the transaction by committing to an `iceberg::Catalog`
44+ //! // implementation. This will cause a table update to occur.
45+ //! let table = tx
46+ //! .commit(&some_catalog_impl)
47+ //! .await
48+ //! .unwrap();
49+ //! ```
1950
2051/// The `ApplyTransactionAction` trait provides an `apply` method
2152/// that allows users to apply a transaction action to a `Transaction`.
You can’t perform that action at this time.
0 commit comments