Add --purge option to drop table CLI - #3718
Open
jx2lee wants to merge 3 commits into
Open
Conversation
jx2lee
marked this pull request as ready for review
July 28, 2026 13:33
jayceslesar
approved these changes
Jul 28, 2026
jayceslesar
left a comment
Contributor
There was a problem hiding this comment.
Does it make more sense for this to be its own CLI command instead of a flag? Doesn't make a huge difference to me but I think the option you have here more closely aligns with Java DDL
ebyhr
reviewed
Jul 28, 2026
|
|
||
| @drop.command() | ||
| @click.argument("identifier") | ||
| @click.option("--purge", is_flag=True, help="Physically delete all table files.") |
Member
There was a problem hiding this comment.
Can we update cli.md? If not, PyIceberg users might not be aware of this option.
Contributor
Author
There was a problem hiding this comment.
@ebyhr Good point ! Added short example to cli.md !
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale for this change
PyIceberg already exposes
Catalog.purge_table, but the CLI only supports dropping a table throughcatalog.drop_table.This adds a
--purgeoption topyiceberg drop tableso users can request the existing catalog purge behavior from the CLI. The default behavior remains unchanged: without--purge, the command still callscatalog.drop_table.Are these changes tested?
Yes.
make test PYTEST_ARGS="tests/cli/test_console.py -v -k 'drop_table'"uv run prek run ruff --files pyiceberg/cli/console.py tests/cli/test_console.pyuv run prek run ruff-format --files pyiceberg/cli/console.py tests/cli/ test_console.pyAre there any user-facing changes?
Yes.
pyiceberg drop table <identifier> --purgeis now available and callscatalog.purge_table(identifier).