Skip to content

Commit 279da78

Browse files
authored
Merge pull request #553 from swalrus1/add-missing-scheme-types
add missing scheme entry types
2 parents 24badc7 + 4fa3ce0 commit 279da78

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

ydb/scheme.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ class SchemeEntryType(enum.IntEnum):
2424
SEQUENCE = 15
2525
REPLICATION = 16
2626
TOPIC = 17
27+
EXTERNAL_TABLE = 18
28+
EXTERNAL_DATA_SOURCE = 19
29+
VIEW = 20
30+
RESOURCE_POOL = 21
2731

2832
@classmethod
2933
def _missing_(cls, value):
@@ -103,6 +107,38 @@ def is_directory_or_database(entry):
103107
"""
104108
return entry == SchemeEntryType.DATABASE or entry == SchemeEntryType.DIRECTORY
105109

110+
@staticmethod
111+
def is_external_table(entry):
112+
"""
113+
:param entry: A scheme entry to check
114+
:return: True if scheme entry is an external table and False otherwise
115+
"""
116+
return entry == SchemeEntryType.EXTERNAL_TABLE
117+
118+
@staticmethod
119+
def is_external_data_source(entry):
120+
"""
121+
:param entry: A scheme entry to check
122+
:return: True if scheme entry is an external data source and False otherwise
123+
"""
124+
return entry == SchemeEntryType.EXTERNAL_DATA_SOURCE
125+
126+
@staticmethod
127+
def is_external_view(entry):
128+
"""
129+
:param entry: A scheme entry to check
130+
:return: True if scheme entry is a view and False otherwise
131+
"""
132+
return entry == SchemeEntryType.VIEW
133+
134+
@staticmethod
135+
def is_external_resource_pool(entry):
136+
"""
137+
:param entry: A scheme entry to check
138+
:return: True if scheme entry is a resource pool and False otherwise
139+
"""
140+
return entry == SchemeEntryType.RESOURCE_POOL
141+
106142

107143
class SchemeEntry(object):
108144
__slots__ = (
@@ -185,6 +221,30 @@ def is_coordination_node(self):
185221
"""
186222
return SchemeEntryType.is_coordination_node(self.type)
187223

224+
def is_external_table(self):
225+
"""
226+
:return: True if scheme entry is an external table and False otherwise
227+
"""
228+
return SchemeEntryType.is_external_table(self.type)
229+
230+
def is_external_data_source(self):
231+
"""
232+
:return: True if scheme entry is an external data source and False otherwise
233+
"""
234+
return SchemeEntryType.is_external_data_source(self.type)
235+
236+
def is_view(self):
237+
"""
238+
:return: True if scheme entry is a view and False otherwise
239+
"""
240+
return SchemeEntryType.is_view(self.type)
241+
242+
def is_resource_pool(self):
243+
"""
244+
:return: True if scheme entry is a resource pool and False otherwise
245+
"""
246+
return SchemeEntryType.is_resource_pool(self.type)
247+
188248

189249
class Directory(SchemeEntry):
190250
__slots__ = ("children",)

0 commit comments

Comments
 (0)