Skip to content

Support creating tags #573

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

Closed
enkidulan opened this issue Apr 3, 2024 · 3 comments · Fixed by #728
Closed

Support creating tags #573

enkidulan opened this issue Apr 3, 2024 · 3 comments · Fixed by #728

Comments

@enkidulan
Copy link
Contributor

Feature Request / Improvement

Historical tags in iceberg docs - https://iceberg.apache.org/docs/1.5.0/branching/#historical-tags

Not sure if it was intentional behavior, but pyiceberg v0.6.0 allowed tagging by using public set_ref_snapshot method:

with table.transaction() as transaction:
    transaction.set_ref_snapshot(
        snapshot_id=snapshot_id,
        parent_snapshot_id=snapshot_id,
        ref_name=revision,
        type="tag",
    )

The new dev version (the current main branch) has deprecated the set_ref_snapshot method, so I can't find a way to create a tag using public methods on the transaction object.

@enkidulan
Copy link
Contributor Author

enkidulan commented Apr 3, 2024

For the reference, I was able to make a tag only by using some private properties of the transaction object:

from pyiceberg.table import SetSnapshotRefUpdate, update_table_metadata

with table.transaction() as txn:
    update = SetSnapshotRefUpdate(
        ref_name=tag,
        type="tag",
        snapshot_id=snapshot_id,
        max_ref_age_ms=None,
        max_snapshot_age_ms=None,
        min_snapshots_to_keep=None,
    )
    txn._updates = [update]
    txn.table_metadata = update_table_metadata(txn.table_metadata, [update])

This seems to work fine as a temporary workaround for development purposes, but it would be great to have a public method for creating tags.

@Fokko
Copy link
Contributor

Fokko commented Apr 5, 2024

@enkidulan Thanks for reaching out here. Are you interested in creating the API for this? :)

@chinmay-bhat
Copy link
Contributor

@Fokko I saw this issue has been inactive for over a month, so I created a PR that might close the issue. Please review when possible :)

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