Skip to content

refactor: consolidate snapshot expiration into MaintenanceTable #2143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 29 commits into
base: main
Choose a base branch
from

Conversation

ForeverAngry
Copy link
Contributor

Rationale for this change

Consolidates snapshot expiration functionality from the standalone ExpireSnapshots class into the MaintenanceTable class for a unified maintenance API. This was planned work left over from #1880.

Are these changes tested?

Yes - but the pr is predicated on the final changes from #1200.

Are there any user-facing changes?

Breaking Changes

  • ✅ Move ExpireSnapshots functionality to MaintenanceTable
  • ✅ Replace fluent API with direct execution pattern
  • ✅ Remove ExpireSnapshots class entirely
  • ✅ Update all tests to use new table.maintenance.* API
  • ✅ Maintain all existing validation and protection logic

API Changes

Before:

table.expire_snapshots().expire_snapshot_by_id(snapshot_id).commit()

jayceslesar and others added 28 commits April 29, 2025 16:58
- Move ExpireSnapshots functionality from standalone class to MaintenanceTable
- Replace fluent API (table.expire_snapshots().method().commit()) with direct execution (table.maintenance.method())
- Remove ExpireSnapshots class and integrate logic into maintenance operations
- Update all tests to use new unified maintenance API
- Maintain all existing validation and protection logic for snapshots

This change consolidates table maintenance operations under a single interface
and simplifies the API by removing the need for explicit commit calls.

Breaking change: table.expire_snapshots() API is replaced with table.maintenance.expire_*() methods
@ForeverAngry
Copy link
Contributor Author

@Fokko @jayceslesar let me know if you guys prefer i stack this pr into the #1200 or if you both would rather i wait until the #1200 is merged into main, and then rebase on the updated upstream/main, and then create the PR against apache/iceberg-python:main!

@Fokko
Copy link
Contributor

Fokko commented Jun 24, 2025

Great seeing this PR @ForeverAngry, thanks again for working on this! I'm okay with first merging #1200, but we could also merge this first, and adapt the remove orphan files routine to use .maintenance. Let me follow up on the remove orphan files, because there are some open questions there.

@Fokko Fokko added this to the PyIceberg 0.10.0 milestone Jun 24, 2025
- Move ExpireSnapshots functionality from standalone class to MaintenanceTable
- Replace fluent API (table.expire_snapshots().method().commit()) with direct execution (table.maintenance.method())
- Remove ExpireSnapshots class and integrate logic into maintenance operations
- Update all tests to use new unified maintenance API
- Maintain all existing validation and protection logic for snapshots

This change consolidates table maintenance operations under a single interface
and simplifies the API by removing the need for explicit commit calls.

Breaking change: table.expire_snapshots() API is replaced with table.maintenance.expire_*() methods
@ForeverAngry
Copy link
Contributor Author

@Fokko did you decide if you wanted me to stay stacked on the delete orphans pr, or go ahead and prepare the pr for this, to the main branch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants