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
<!--
Thanks for opening a pull request!
-->
<!-- In the case this PR will resolve an issue, please replace
${GITHUB_ISSUE_ID} below with the actual Github issue id. -->
<!-- Closes #${GITHUB_ISSUE_ID} -->
# Rationale for this change
Improved docs for tagging and branching to explicitly show how to create
and delete branches/tags along with their props
## Are these changes tested?
No code changes.
## Are there any user-facing changes?
No
<!-- In the case of user-facing changes, please add the changelog label.
-->
Tags are named references to snapshots that are immutable. They can be used to mark important snapshots for long-term retention or to reference specific table versions.
Branches are mutable named references to snapshots that can be updated over time. They allow for independent lineages of table changes, enabling use cases like development branches, testing environments, or parallel workflows.
1383
+
1384
+
Create a branch pointing to a specific snapshot:
1385
+
1386
+
```python
1387
+
# Create a branch with default settings
1388
+
table.manage_snapshots().create_branch(
1389
+
snapshot_id=snapshot_id,
1390
+
branch_name="dev"
1391
+
).commit()
1392
+
1393
+
# Create a branch with retention policies
1394
+
table.manage_snapshots().create_branch(
1395
+
snapshot_id=snapshot_id,
1396
+
branch_name="dev",
1397
+
max_ref_age_ms=604800000, # Max age of the branch reference (7 days)
1398
+
max_snapshot_age_ms=259200000, # Max age of snapshots to keep (3 days)
1399
+
min_snapshots_to_keep=10# Minimum number of snapshots to retain
PyIceberg provides table maintenance operations through the `table.maintenance` API. This provides a clean interface for performing maintenance tasks like snapshot expiration.
0 commit comments