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 Catalog.replace_table shortcut, keep replace_table_transaction only
Mirrors Java, which exposes newReplaceTableTransaction only and has no
top-level Catalog.replaceTable. Callers go through the transaction
explicitly and follow up with load_table() when a fresh handle is
needed, sidestepping the StagedTable return-type wart on the shortcut.
Also collapse the docs section to the single RTAS-flow example.
Copy file name to clipboardExpand all lines: mkdocs/docs/api.md
+5-23Lines changed: 5 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -187,36 +187,18 @@ 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). `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
-
192
-
```python
193
-
from pyiceberg.schema import Schema
194
-
from pyiceberg.types import NestedField, LongType, StringType, BooleanType
Field IDs are reused by name from the previous schema; new columns get fresh IDs above `last-column-id`.
205
-
206
-
Unlike the other fields, table properties are *merged* on replace: properties you don't pass are preserved on the table. To remove a property as part of the replace, use `replace_table_transaction` and drop it explicitly within the transaction.
207
-
208
-
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:
190
+
Atomically replace an existing table's schema, partition spec, sort order, location, and properties via `replace_table_transaction`. 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). Open the transaction with the new definition, stage any additional changes (writes, property updates, schema evolution), and commit — for example, an RTAS (replace-table-as-select) that swaps the schema and writes the new data atomically:
209
191
210
192
```python
211
193
with catalog.replace_table_transaction(identifier="docs_example.bids", schema=df.schema) as txn:
212
194
txn.append(df)
213
195
```
214
196
215
-
To upgrade the table's format version as part of the replace, pass `format-version` in `properties`:
197
+
Field IDs are reused by name from the previous schema; new columns get fresh IDs above `last-column-id`.
Table properties are *merged* on replace: properties you don't pass are preserved on the table. To remove a property, drop it explicitly within the transaction.
200
+
201
+
Pass `format-version` in `properties` to upgrade the table's format version as part of the replace.
0 commit comments