Skip to content

Conversation

@geruh
Copy link
Contributor

@geruh geruh commented Dec 29, 2025

Rationale for this change

This PR adds the ability to change the set the current snapshot of a table. A bulk of this work was done in #758 but instead we have broken it out to focus on the set snapshot logic first. Additionally I added a few more tests, following the existing expire snapshots behavior.

Are these changes tested?

Yes, added tests

Are there any user-facing changes?

New API :)

table.manage_snapshots().set_current_snapshot(snapshot_id=123456789).commit()


table.manage_snapshots().set_current_snapshot(ref_name="my-tag").commit()

# chaining
table.manage_snapshots() \
      .create_tag(snapshot_id=older_id, tag_name="my-tag") \
      .set_current_snapshot(ref_name="my-tag") \
      .commit()

Co-authored-by: Chinmay Bhat <12948588+chinmay-bhat@users.noreply.github.com>
if self._transaction.table_metadata.snapshot_by_id(target_snapshot_id) is None:
raise ValueError(f"Cannot set current snapshot to unknown snapshot id: {target_snapshot_id}")

update, requirement = self._transaction._set_ref_snapshot(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can rip this helper out of transaction and leave in managesnapshots api.

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.

1 participant