Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
ccfcbcd
chore: scaffolding
JasperHG90 Jan 5, 2025
95da8f3
chore: scaffolding
JasperHG90 Jan 5, 2025
253967d
chore: add skeleton for asc/desc methods
JasperHG90 Jan 5, 2025
7b5a98e
chore: scaffolding
JasperHG90 Jan 5, 2025
304a806
chore: change method names
JasperHG90 Jan 5, 2025
48ac5c0
chore: update methods
JasperHG90 Jan 7, 2025
a47067c
chore: update methods
JasperHG90 Jan 7, 2025
c1ab2ec
chore: update imports
JasperHG90 Jan 7, 2025
8f27d14
chore: stupid renames
JasperHG90 Jan 7, 2025
d8720f2
chore: lint
JasperHG90 Jan 7, 2025
90db60a
chore: docstrings
JasperHG90 Jan 7, 2025
1cd2729
test: add integration test for replace sort order
JasperHG90 Jan 8, 2025
0a1e781
test: add test for lookup
JasperHG90 Jan 8, 2025
a550ccb
refactor: add last sort order id
JasperHG90 Jan 8, 2025
8b09255
refactor: add last sort order id and increment
JasperHG90 Jan 8, 2025
67b9e52
chore: add imports
JasperHG90 Jan 8, 2025
dcaa63f
feat: add apply and commit methods
JasperHG90 Jan 8, 2025
ced6a4b
test: remove spec stuff
JasperHG90 Jan 8, 2025
43e09a3
chore: remove unused import
JasperHG90 Jan 8, 2025
b460c34
chore: add ReplaceSortOrder to the Transaction class
JasperHG90 Jan 10, 2025
190071f
chore: lint
JasperHG90 Jan 10, 2025
e9475de
Merge branch 'apache:main' into feat/update-sort-order
JasperHG90 Jan 10, 2025
eafafaf
Merge branch 'apache:main' into feat/update-sort-order
JasperHG90 Jan 24, 2025
ec5f711
chore: renames (replace to update)
JasperHG90 Jan 24, 2025
d69a071
chore: renames (replace to update)
JasperHG90 Jan 24, 2025
b5a5bd8
test: add test updating sort order
JasperHG90 Jan 24, 2025
8080fa5
refactor: remove the sort order builder
JasperHG90 Jan 24, 2025
e77a2c1
chore: remove sort order builder
JasperHG90 Jan 24, 2025
fc32b28
chore: lint
JasperHG90 Jan 24, 2025
fa1aa50
chore: update comment
JasperHG90 Jan 25, 2025
1aa6270
Merge branch 'apache:main' into feat/update-sort-order
JasperHG90 Feb 16, 2025
2e9cd3f
test: parametrize over iceberg format versions and remove unnused code
JasperHG90 Feb 16, 2025
137dbd9
chore: fmt
JasperHG90 Feb 16, 2025
d8b9001
Update pyiceberg/table/update/sorting.py
JasperHG90 Feb 16, 2025
58d302d
Update pyiceberg/table/__init__.py
JasperHG90 Feb 16, 2025
0b543b8
Merge branch 'feat/update-sort-order' of https://github.com/JasperHG9…
JasperHG90 Feb 16, 2025
fd0e287
chore: add arg
JasperHG90 Feb 16, 2025
5e57697
chore: fmt
JasperHG90 Feb 16, 2025
5131903
docs: update docs
JasperHG90 Feb 16, 2025
cc1ae1c
chore: set default
JasperHG90 Feb 16, 2025
2ae47e3
Merge branch 'apache:main' into feat/update-sort-order
JasperHG90 Mar 23, 2025
d99dfdd
chore: lint and update names
JasperHG90 Mar 23, 2025
9d77f3f
chore: determine if a sort order is newly added. If so, set the last …
JasperHG90 Mar 24, 2025
3f6a953
test: add test for re-using previously defineed sort order
JasperHG90 Mar 24, 2025
7223fdd
chore: fmt
JasperHG90 Mar 24, 2025
18ced3f
chore: only set last assigned order id when sure that a new sort orde…
JasperHG90 Mar 24, 2025
8f425fb
test: add test for reverting back to unsorted sort order
JasperHG90 Mar 24, 2025
f9efab3
chore: fmt
JasperHG90 Mar 24, 2025
03f0a1b
Merge branch 'apache:main' into feat/update-sort-order
JasperHG90 Apr 24, 2025
46fd88b
Merge branch 'apache:main' into feat/update-sort-order
JasperHG90 May 6, 2025
353178f
Make the CI happy
Fokko Sep 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions mkdocs/docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1270,6 +1270,24 @@ with table.update_spec() as update:
update.rename_field("bucketed_id", "sharded_id")
```

## Sort order updates

Users can update the sort order on existing tables for new data. See [sorting](https://iceberg.apache.org/spec/#sorting) for more details.

The API to use when updating a sort order is the `update_sort_order` API on the table.

Sort orders can only be updated by adding a new sort order. They cannot be deleted or modified.

### Updating a sort order on a table

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.

```python
with table.update_sort_order() as update:
update.desc("event_ts", DayTransform(), NullOrder.NULLS_FIRST)
update.asc("some_field", IdentityTransform(), NullOrder.NULLS_LAST)
```

## Table properties

Set and remove properties through the `Transaction` API:
Expand Down
Loading