Skip to content

Commit 40dd508

Browse files
committed
BUG23583381: Add who_am_i and am_i_real methods to DatabaseObject
These methods are just aliases for get_name and exists_in_database methods. Existing tests are available.
1 parent c0dc8ad commit 40dd508

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/mysqlx/crud.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,22 @@ def get_name(self):
7979
"""
8080
return self._name
8181

82+
def exists_in_database(self):
83+
"""Verifies if this object exists in the database.
84+
85+
Returns:
86+
bool: `True` if object exists in database.
87+
88+
Raises:
89+
NotImplementedError: This method must be implemented.
90+
"""
91+
raise NotImplementedError
92+
93+
def am_i_real(self):
94+
return self.exists_in_database()
95+
96+
def who_am_i(self):
97+
return self.get_name()
8298

8399
class Schema(DatabaseObject):
84100
"""A client-side representation of a database schema. Provides access to

0 commit comments

Comments
 (0)