Skip to content

Commit 5131903

Browse files
committed
docs: update docs
1 parent 5e57697 commit 5131903

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

mkdocs/docs/api.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,6 +1194,24 @@ with table.update_spec() as update:
11941194
update.rename_field("bucketed_id", "sharded_id")
11951195
```
11961196

1197+
## Sort order updates
1198+
1199+
Users can update the sort order on existing tables for new data. See [sorting](https://iceberg.apache.org/spec/#sorting) for more details.
1200+
1201+
The API to use when updating a sort order is the `update_sort_order` API on the table.
1202+
1203+
Sort orders can only be updated by adding a new sort order. They cannot be deleted or modified.
1204+
1205+
### Updating a sort order on a table
1206+
1207+
To create a new sort order, you can use either the `asc` or `desc` API depending on whether you want you data sorted in ascending or descending order. Both take the name of the field, the sort order transform, and a null order that describes the order of null values when sorted.
1208+
1209+
```python
1210+
with table.update_sort_order() as update:
1211+
update.desc("event_ts", DayTransform(), NullOrder.NULLS_FIRST)
1212+
update.asc("some_field", IdentityTransform(), NullOrder.NULLS_LAST)
1213+
```
1214+
11971215
## Table properties
11981216

11991217
Set and remove properties through the `Transaction` API:

0 commit comments

Comments
 (0)