From e81b6f7af6785c23032c5c8775907d9997d8ae4d Mon Sep 17 00:00:00 2001
From: Alex Bobkov <abqu144@yandex.ru>
Date: Fri, 15 Sep 2023 17:05:19 +0300
Subject: [PATCH] added 'type' field for table indexes

---
 ydb/table.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/ydb/table.py b/ydb/table.py
index c21392bb..5686d27a 100644
--- a/ydb/table.py
+++ b/ydb/table.py
@@ -286,6 +286,7 @@ def __init__(self, name):
         self.index_columns = []
         # output only.
         self.status = None
+        self.type = None
 
     def with_global_index(self):
         self._pb.global_index.SetInParent()
@@ -301,6 +302,12 @@ def to_pb(self):
         return self._pb
 
 
+@enum.unique
+class IndexType(enum.IntEnum):
+    SYNCHRONOUS = 0
+    ASYNCHRONOUS = 1
+    
+
 class ReplicationPolicy(object):
     def __init__(self):
         self._pb = _apis.ydb_table.ReplicationPolicy()
@@ -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)
+    else:
+        result.type = IndexType(IndexType.SYNCHRONOUS)
     return result