You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Drop view-collision pre-flight check; deferring to a follow-up PR
that ports the check across create/replace/rename in one pass.
- Simplify RTAS tests + docs to use txn.append(df) instead of the
verbose update_snapshot().fast_append() + _dataframe_to_data_files
pattern.
- Drop parallel new_schema construction in RTAS tests; pass df.schema
directly (replace_table* accepts Schema | pa.Schema).
- Reword docs intro per reviewer suggestion.
- Run formatter / linter; trailing whitespace and trailing newline fix.
- mypy: cast format_version to TableVersion; extract inner with into
helper to silence unreachable warning under pytest.raises.
Copy file name to clipboardExpand all lines: mkdocs/docs/api.md
+6-19Lines changed: 6 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -187,41 +187,28 @@ with catalog.create_table_transaction(identifier="docs_example.bids", schema=sch
187
187
188
188
## Replace a table
189
189
190
-
Atomically replace an existing table's schema, partition spec, sort order, location, and properties. The table UUID and history (snapshots, schemas, specs, sort orders, metadata log) are preserved; the current snapshot is cleared (the `main` branch ref is removed). Use this when you want to redefine the table's metadata; pair it with `replace_table_transaction` to atomically write new data alongside the metadata change (RTAS-style).
190
+
Atomically replace an existing table's schema, partition spec, sort order, location, and properties. The table UUID and history (snapshots, schemas, specs, sort orders, metadata log) are preserved; the current snapshot is cleared (the `main` branch ref is removed). `replace_table` redefines the table in this way; `replace_table_transaction` lets you write new data alongside this change to permit RTAS (replace-table-as-select) workflows.
191
191
192
192
```python
193
-
from pyiceberg.schema import Schema
194
-
from pyiceberg.types import NestedField, LongType, StringType, BooleanType
Field IDs from columns whose names appear in the previous schema are reused, so existing data files remain readable when the new schema is a compatible superset. New columns get fresh IDs above `last-column-id`.
196
+
Where `df` is a PyArrow table (or `Schema`) carrying the new column set. Field IDs from columns whose names appear in the previous schema are reused, so existing data files remain readable when the new schema is a compatible superset. New columns get fresh IDs above `last-column-id`.
208
197
209
198
Properties passed to `replace_table` are **merged** with the existing table properties (your values override; existing keys you don't pass are preserved). To remove a property as part of the replace, use `replace_table_transaction` and remove it explicitly within the transaction.
210
199
211
200
Use `replace_table_transaction` to stage additional changes (writes, property updates, schema evolution) before committing — for example, swap the schema and write new data atomically:
212
201
213
202
```python
214
-
with catalog.replace_table_transaction(identifier="docs_example.bids", schema=new_schema) as txn:
215
-
with txn.update_snapshot().fast_append() as snap:
216
-
for data_file in _dataframe_to_data_files(table_metadata=txn.table_metadata, df=df, io=txn._table.io):
217
-
snap.append_data_file(data_file)
203
+
with catalog.replace_table_transaction(identifier="docs_example.bids", schema=df.schema) as txn:
0 commit comments