diff --git a/ydb/scheme.py b/ydb/scheme.py index 04951b5e..263d1c65 100644 --- a/ydb/scheme.py +++ b/ydb/scheme.py @@ -24,6 +24,10 @@ class SchemeEntryType(enum.IntEnum): SEQUENCE = 15 REPLICATION = 16 TOPIC = 17 + EXTERNAL_TABLE = 18 + EXTERNAL_DATA_SOURCE = 19 + VIEW = 20 + RESOURCE_POOL = 21 @classmethod def _missing_(cls, value): @@ -103,6 +107,38 @@ def is_directory_or_database(entry): """ return entry == SchemeEntryType.DATABASE or entry == SchemeEntryType.DIRECTORY + @staticmethod + def is_external_table(entry): + """ + :param entry: A scheme entry to check + :return: True if scheme entry is an external table and False otherwise + """ + return entry == SchemeEntryType.EXTERNAL_TABLE + + @staticmethod + def is_external_data_source(entry): + """ + :param entry: A scheme entry to check + :return: True if scheme entry is an external data source and False otherwise + """ + return entry == SchemeEntryType.EXTERNAL_DATA_SOURCE + + @staticmethod + def is_external_view(entry): + """ + :param entry: A scheme entry to check + :return: True if scheme entry is a view and False otherwise + """ + return entry == SchemeEntryType.VIEW + + @staticmethod + def is_external_resource_pool(entry): + """ + :param entry: A scheme entry to check + :return: True if scheme entry is a resource pool and False otherwise + """ + return entry == SchemeEntryType.RESOURCE_POOL + class SchemeEntry(object): __slots__ = ( @@ -185,6 +221,30 @@ def is_coordination_node(self): """ return SchemeEntryType.is_coordination_node(self.type) + def is_external_table(self): + """ + :return: True if scheme entry is an external table and False otherwise + """ + return SchemeEntryType.is_external_table(self.type) + + def is_external_data_source(self): + """ + :return: True if scheme entry is an external data source and False otherwise + """ + return SchemeEntryType.is_external_data_source(self.type) + + def is_view(self): + """ + :return: True if scheme entry is a view and False otherwise + """ + return SchemeEntryType.is_view(self.type) + + def is_resource_pool(self): + """ + :return: True if scheme entry is a resource pool and False otherwise + """ + return SchemeEntryType.is_resource_pool(self.type) + class Directory(SchemeEntry): __slots__ = ("children",)