File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
crates/iceberg/src/transaction Expand file tree Collapse file tree 1 file changed +34
-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+ //! ```
28+ //! // Create a transaction.
29+ //! let tx = Transaction::new(my_table);
30+ //!
31+ //! // Create a `FastAppendAction` which will not rewrite or append
32+ //! // to existing metadata. This will create a new manifest.
33+ //! let mut action = tx
34+ //! .fast_append(None, Vec::new())
35+ //! .expect("a transaction can be validated with this input");
36+ //!
37+ //! action
38+ //! .add_data_files(my_data_files)
39+ //! .unwrap();
40+ //!
41+ //! let tx = action
42+ //! .apply()
43+ //! .await
44+ //! .unwrap();
45+ //!
46+ //! // End the transaction by committing to an `iceberg::Catalog`
47+ //! // implementation. This will cause a table update to occur.
48+ //! let table = tx
49+ //! .commit(some_catalog_impl)
50+ //! .await
51+ //! .unwrap();
52+ //! ```
1953
2054mod action;
2155mod append;
You can’t perform that action at this time.
0 commit comments