This is an automated email from the ASF dual-hosted git repository.
lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git
The following commit(s) were added to refs/heads/master by this push:
new 005061ae2e [python] rename drop_database/drop_table ignore_if_exists
flag to ignore_if_not_exists (#6846)
005061ae2e is described below
commit 005061ae2e707ba1dda3a513ee3109a62a116713
Author: Jiajia Li <[email protected]>
AuthorDate: Wed Dec 24 09:02:07 2025 +0800
[python] rename drop_database/drop_table ignore_if_exists flag to
ignore_if_not_exists (#6846)
---
paimon-python/pypaimon/catalog/rest/rest_catalog.py | 8 ++++----
paimon-python/pypaimon/tests/py36/ao_simple_test.py | 4 ++--
paimon-python/pypaimon/tests/rest/rest_simple_test.py | 4 ++--
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/paimon-python/pypaimon/catalog/rest/rest_catalog.py
b/paimon-python/pypaimon/catalog/rest/rest_catalog.py
index ca46eb1f5f..c32c5bcb39 100644
--- a/paimon-python/pypaimon/catalog/rest/rest_catalog.py
+++ b/paimon-python/pypaimon/catalog/rest/rest_catalog.py
@@ -120,11 +120,11 @@ class RESTCatalog(Catalog):
if response is not None:
return Database(name, options)
- def drop_database(self, name: str, ignore_if_exists: bool = False):
+ def drop_database(self, name: str, ignore_if_not_exists: bool = False):
try:
self.rest_api.drop_database(name)
except NoSuchResourceException as e:
- if not ignore_if_exists:
+ if not ignore_if_not_exists:
# Convert REST API exception to catalog exception
raise DatabaseNotExistException(name) from e
@@ -168,13 +168,13 @@ class RESTCatalog(Catalog):
if not ignore_if_exists:
raise TableAlreadyExistException(identifier) from e
- def drop_table(self, identifier: Union[str, Identifier], ignore_if_exists:
bool = False):
+ def drop_table(self, identifier: Union[str, Identifier],
ignore_if_not_exists: bool = False):
if not isinstance(identifier, Identifier):
identifier = Identifier.from_string(identifier)
try:
self.rest_api.drop_table(identifier)
except NoSuchResourceException as e:
- if not ignore_if_exists:
+ if not ignore_if_not_exists:
raise TableNotExistException(identifier) from e
def load_table_metadata(self, identifier: Identifier) -> TableMetadata:
diff --git a/paimon-python/pypaimon/tests/py36/ao_simple_test.py
b/paimon-python/pypaimon/tests/py36/ao_simple_test.py
index 9ad2e8e6eb..183a3a72a6 100644
--- a/paimon-python/pypaimon/tests/py36/ao_simple_test.py
+++ b/paimon-python/pypaimon/tests/py36/ao_simple_test.py
@@ -380,7 +380,7 @@ class AOSimpleTest(RESTBaseTest):
try:
self.rest_catalog.drop_table("db1.tbl1", True)
except TableNotExistException:
- self.fail("drop_table with ignore_if_exists=True should not raise
TableNotExistException")
+ self.fail("drop_table with ignore_if_not_exists=True should not
raise TableNotExistException")
# test drop database
self.rest_catalog.drop_database("db1", False)
@@ -391,7 +391,7 @@ class AOSimpleTest(RESTBaseTest):
try:
self.rest_catalog.drop_database("db1", True)
except DatabaseNotExistException:
- self.fail("drop_database with ignore_if_exists=True should not
raise DatabaseNotExistException")
+ self.fail("drop_database with ignore_if_not_exists=True should not
raise DatabaseNotExistException")
def test_initialize_oss_fs_pyarrow_lt_7(self):
props = {
diff --git a/paimon-python/pypaimon/tests/rest/rest_simple_test.py
b/paimon-python/pypaimon/tests/rest/rest_simple_test.py
index c308c36aa6..c5be4ad473 100644
--- a/paimon-python/pypaimon/tests/rest/rest_simple_test.py
+++ b/paimon-python/pypaimon/tests/rest/rest_simple_test.py
@@ -698,7 +698,7 @@ class RESTSimpleTest(RESTBaseTest):
try:
self.rest_catalog.drop_table("db1.tbl1", True)
except TableNotExistException:
- self.fail("drop_table with ignore_if_exists=True should not raise
TableNotExistException")
+ self.fail("drop_table with ignore_if_not_exists=True should not
raise TableNotExistException")
# test drop database
self.rest_catalog.drop_database("db1", False)
@@ -709,4 +709,4 @@ class RESTSimpleTest(RESTBaseTest):
try:
self.rest_catalog.drop_database("db1", True)
except DatabaseNotExistException:
- self.fail("drop_database with ignore_if_exists=True should not
raise DatabaseNotExistException")
+ self.fail("drop_database with ignore_if_not_exists=True should not
raise DatabaseNotExistException")