-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getting index type #352
base: main
Are you sure you want to change the base?
getting index type #352
Conversation
@@ -301,6 +302,12 @@ def to_pb(self): | |||
return self._pb | |||
|
|||
|
|||
@enum.unique | |||
class IndexType(enum.IntEnum): | |||
SYNCHRONOUS = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use enum.auto()
here
@@ -1337,6 +1344,10 @@ def async_bulk_upsert(self, table_path, rows, column_types, settings=None): | |||
def _make_index_description(index): | |||
result = TableIndex(index.name).with_index_columns(*tuple(col for col in index.index_columns)) | |||
result.status = IndexStatus(index.status) | |||
if index.HasField("global_async_index"): | |||
result.type = IndexType(IndexType.ASYNCHRONOUS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no needs to IndexType(IndexType.ASYNCHRONOUS)
. IndexType.ASYNCHRONOUS
/IndexType.SYNCHRONOUS
close enough.
@@ -286,6 +286,7 @@ def __init__(self, name): | |||
self.index_columns = [] | |||
# output only. | |||
self.status = None | |||
self.type = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this field also should be in the constructor
Привет! Спасибо за патч. Можешь, пожалуйста, ещё тестом это покрыть?) |
@Valeria1235, Hi! I tried to use the same approach, but I get nither |
Hi! I was just only reviewed this patch and as you can see there are no one tests cases. So perhaps it's no longer working or relevant. |
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en
Pull request type
Please check the type of change your PR introduces:
What is the current behavior?
Метод session.describe_table возвращает в том числе объекты, описывающие индексы таблицы - TableIndex. Этот объект не содержит информации о типе индекса (синхронный или асинхронный), хотя эта информация есть в protobuf сообщении, на основе которого формируется объект.
Issue Number: #351
What is the new behavior?
TableIndex содержать поле type - enum, описывающий тип индекса.