Skip to content

Commit 005061a

Browse files
[python] rename drop_database/drop_table ignore_if_exists flag to ignore_if_not_exists (#6846)
1 parent bc942cd commit 005061a

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

paimon-python/pypaimon/catalog/rest/rest_catalog.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,11 @@ def get_database(self, name: str) -> Database:
120120
if response is not None:
121121
return Database(name, options)
122122

123-
def drop_database(self, name: str, ignore_if_exists: bool = False):
123+
def drop_database(self, name: str, ignore_if_not_exists: bool = False):
124124
try:
125125
self.rest_api.drop_database(name)
126126
except NoSuchResourceException as e:
127-
if not ignore_if_exists:
127+
if not ignore_if_not_exists:
128128
# Convert REST API exception to catalog exception
129129
raise DatabaseNotExistException(name) from e
130130

@@ -168,13 +168,13 @@ def create_table(self, identifier: Union[str, Identifier], schema: Schema, ignor
168168
if not ignore_if_exists:
169169
raise TableAlreadyExistException(identifier) from e
170170

171-
def drop_table(self, identifier: Union[str, Identifier], ignore_if_exists: bool = False):
171+
def drop_table(self, identifier: Union[str, Identifier], ignore_if_not_exists: bool = False):
172172
if not isinstance(identifier, Identifier):
173173
identifier = Identifier.from_string(identifier)
174174
try:
175175
self.rest_api.drop_table(identifier)
176176
except NoSuchResourceException as e:
177-
if not ignore_if_exists:
177+
if not ignore_if_not_exists:
178178
raise TableNotExistException(identifier) from e
179179

180180
def load_table_metadata(self, identifier: Identifier) -> TableMetadata:

paimon-python/pypaimon/tests/py36/ao_simple_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ def test_create_drop_database_table(self):
380380
try:
381381
self.rest_catalog.drop_table("db1.tbl1", True)
382382
except TableNotExistException:
383-
self.fail("drop_table with ignore_if_exists=True should not raise TableNotExistException")
383+
self.fail("drop_table with ignore_if_not_exists=True should not raise TableNotExistException")
384384

385385
# test drop database
386386
self.rest_catalog.drop_database("db1", False)
@@ -391,7 +391,7 @@ def test_create_drop_database_table(self):
391391
try:
392392
self.rest_catalog.drop_database("db1", True)
393393
except DatabaseNotExistException:
394-
self.fail("drop_database with ignore_if_exists=True should not raise DatabaseNotExistException")
394+
self.fail("drop_database with ignore_if_not_exists=True should not raise DatabaseNotExistException")
395395

396396
def test_initialize_oss_fs_pyarrow_lt_7(self):
397397
props = {

paimon-python/pypaimon/tests/rest/rest_simple_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ def test_create_drop_database_table(self):
698698
try:
699699
self.rest_catalog.drop_table("db1.tbl1", True)
700700
except TableNotExistException:
701-
self.fail("drop_table with ignore_if_exists=True should not raise TableNotExistException")
701+
self.fail("drop_table with ignore_if_not_exists=True should not raise TableNotExistException")
702702

703703
# test drop database
704704
self.rest_catalog.drop_database("db1", False)
@@ -709,4 +709,4 @@ def test_create_drop_database_table(self):
709709
try:
710710
self.rest_catalog.drop_database("db1", True)
711711
except DatabaseNotExistException:
712-
self.fail("drop_database with ignore_if_exists=True should not raise DatabaseNotExistException")
712+
self.fail("drop_database with ignore_if_not_exists=True should not raise DatabaseNotExistException")

0 commit comments

Comments
 (0)