1
1
# -*- coding: utf-8 -*-
2
2
import abc
3
+ from dataclasses import dataclass
3
4
import ydb
4
5
from abc import abstractmethod
5
6
import logging
@@ -327,6 +328,20 @@ def to_pb(self):
327
328
return self ._pb
328
329
329
330
331
+ @dataclass
332
+ class RenameIndexItem :
333
+ source_name : str
334
+ destination_name : str
335
+ replace_destination : bool = False
336
+
337
+ def to_pb (self ):
338
+ return _apis .ydb_table .RenameIndexItem (
339
+ source_name = self .source_name ,
340
+ destination_name = self .destination_name ,
341
+ replace_destination = self .replace_destination ,
342
+ )
343
+
344
+
330
345
class ReplicationPolicy (object ):
331
346
def __init__ (self ):
332
347
self ._pb = _apis .ydb_table .ReplicationPolicy ()
@@ -1124,6 +1139,7 @@ def alter_table(
1124
1139
alter_partitioning_settings = None ,
1125
1140
set_key_bloom_filter = None ,
1126
1141
set_read_replicas_settings = None ,
1142
+ rename_indexes = None ,
1127
1143
):
1128
1144
pass
1129
1145
@@ -1321,6 +1337,7 @@ def alter_table(
1321
1337
alter_partitioning_settings : Optional ["ydb.PartitioningSettings" ] = None ,
1322
1338
set_key_bloom_filter : Optional ["ydb.FeatureFlag" ] = None ,
1323
1339
set_read_replicas_settings : Optional ["ydb.ReadReplicasSettings" ] = None ,
1340
+ rename_indexes : Optional [List ["ydb.RenameIndexItem" ]] = None ,
1324
1341
) -> "ydb.Operation" :
1325
1342
"""
1326
1343
Alter a YDB table.
@@ -1340,6 +1357,7 @@ def alter_table(
1340
1357
:param set_compaction_policy: Compaction policy
1341
1358
:param alter_partitioning_settings: ydb.PartitioningSettings to alter
1342
1359
:param set_key_bloom_filter: ydb.FeatureFlag to set key bloom filter
1360
+ :param rename_indexes: List of ydb.RenameIndexItem to rename
1343
1361
1344
1362
:return: Operation or YDB error otherwise.
1345
1363
"""
@@ -1364,6 +1382,7 @@ def callee(session: Session):
1364
1382
alter_partitioning_settings = alter_partitioning_settings ,
1365
1383
set_key_bloom_filter = set_key_bloom_filter ,
1366
1384
set_read_replicas_settings = set_read_replicas_settings ,
1385
+ rename_indexes = rename_indexes ,
1367
1386
)
1368
1387
1369
1388
return self ._pool .retry_operation_sync (callee )
@@ -1857,6 +1876,7 @@ def alter_table(
1857
1876
alter_partitioning_settings = None ,
1858
1877
set_key_bloom_filter = None ,
1859
1878
set_read_replicas_settings = None ,
1879
+ rename_indexes = None ,
1860
1880
):
1861
1881
return self ._driver (
1862
1882
_session_impl .alter_table_request_factory (
@@ -1876,6 +1896,7 @@ def alter_table(
1876
1896
alter_partitioning_settings ,
1877
1897
set_key_bloom_filter ,
1878
1898
set_read_replicas_settings ,
1899
+ rename_indexes ,
1879
1900
),
1880
1901
_apis .TableService .Stub ,
1881
1902
_apis .TableService .AlterTable ,
@@ -2088,6 +2109,7 @@ def async_alter_table(
2088
2109
alter_partitioning_settings = None ,
2089
2110
set_key_bloom_filter = None ,
2090
2111
set_read_replicas_settings = None ,
2112
+ rename_indexes = None ,
2091
2113
):
2092
2114
return self ._driver .future (
2093
2115
_session_impl .alter_table_request_factory (
@@ -2107,6 +2129,7 @@ def async_alter_table(
2107
2129
alter_partitioning_settings ,
2108
2130
set_key_bloom_filter ,
2109
2131
set_read_replicas_settings ,
2132
+ rename_indexes ,
2110
2133
),
2111
2134
_apis .TableService .Stub ,
2112
2135
_apis .TableService .AlterTable ,
0 commit comments