1313 _scan_query_request_factory ,
1414 _wrap_scan_query_response ,
1515 BaseTxContext ,
16+ TableDescription ,
1617)
1718from . import _utilities
1819from ydb import _apis , _session_impl
@@ -139,6 +140,11 @@ async def rename_tables(self, rename_items, settings=None): # pylint: disable=W
139140
140141
141142class TableClient (BaseTableClient ):
143+ def __init__ (self , driver , table_client_settings = None ):
144+ # type:(ydb.Driver, ydb.TableClientSettings) -> None
145+ super ().__init__ (driver = driver , table_client_settings = table_client_settings )
146+ self ._pool : SessionPool = SessionPool (self ._driver , 10 )
147+
142148 def session (self ):
143149 return Session (self ._driver , self ._table_client_settings )
144150
@@ -158,6 +164,105 @@ async def scan_query(self, query, parameters=None, settings=None): # pylint: di
158164 lambda resp : _wrap_scan_query_response (resp , self ._table_client_settings ),
159165 )
160166
167+ async def create_table (
168+ self ,
169+ path : str ,
170+ table_description : TableDescription ,
171+ settings : typing .Optional [settings_impl .BaseRequestSettings ] = None ,
172+ ):
173+ """
174+ Create a YDB table.
175+
176+ :param path: A table path
177+ :param table_description: A description of table to create. An instance TableDescription
178+ :param settings: An instance of BaseRequestSettings that describes how rpc should invoked.
179+
180+ :return: A description of created scheme entry or error otherwise.
181+ """
182+ async def callee (session : Session ):
183+ return await session .create_table (path = path , table_description = table_description , settings = settings )
184+
185+ return await self ._pool .retry_operation (callee )
186+
187+ async def drop_table (
188+ self ,
189+ path : str ,
190+ settings : typing .Optional [settings_impl .BaseRequestSettings ] = None ,
191+ ):
192+ async def callee (session : Session ):
193+ return await session .drop_table (path = path , settings = settings )
194+
195+ return await self ._pool .retry_operation (callee )
196+
197+ async def alter_table (
198+ self ,
199+ path ,
200+ add_columns = None ,
201+ drop_columns = None ,
202+ settings = None ,
203+ alter_attributes = None ,
204+ add_indexes = None ,
205+ drop_indexes = None ,
206+ set_ttl_settings = None ,
207+ drop_ttl_settings = None ,
208+ add_column_families = None ,
209+ alter_column_families = None ,
210+ alter_storage_settings = None ,
211+ set_compaction_policy = None ,
212+ alter_partitioning_settings = None ,
213+ set_key_bloom_filter = None ,
214+ set_read_replicas_settings = None ,
215+ ):
216+ async def callee (session : Session ):
217+ return await session .alter_table (
218+ path = path ,
219+ add_columns = add_columns ,
220+ drop_columns = drop_columns ,
221+ settings = settings ,
222+ alter_attributes = alter_attributes ,
223+ add_indexes = add_indexes ,
224+ drop_indexes = drop_indexes ,
225+ set_ttl_settings = set_ttl_settings ,
226+ drop_ttl_settings = drop_ttl_settings ,
227+ add_column_families = add_column_families ,
228+ alter_column_families = alter_column_families ,
229+ alter_storage_settings = alter_storage_settings ,
230+ set_compaction_policy = set_compaction_policy ,
231+ alter_partitioning_settings = alter_partitioning_settings ,
232+ set_key_bloom_filter = set_key_bloom_filter ,
233+ set_read_replicas_settings = set_read_replicas_settings ,
234+ )
235+
236+ return await self ._pool .retry_operation (callee )
237+
238+ async def describe_table (self , path , settings = None ):
239+ async def callee (session : Session ):
240+ return await session .describe_table (path = path , settings = settings )
241+
242+ return await self ._pool .retry_operation (callee )
243+
244+ async def copy_table (self , source_path , destination_path , settings = None ):
245+ async def callee (session : Session ):
246+ return await session .copy_table (
247+ source_path = source_path ,
248+ destination_path = destination_path ,
249+ settings = settings ,
250+ )
251+
252+ return await self ._pool .retry_operation (callee )
253+
254+ async def copy_tables (self , source_destination_pairs , settings = None ):
255+ async def callee (session : Session ):
256+ return await session .copy_tables (source_destination_pairs = source_destination_pairs , settings = settings )
257+
258+ return await self ._pool .retry_operation (callee )
259+
260+ async def rename_tables (self , rename_items , settings = None ):
261+ async def callee (session : Session ):
262+ return await session .rename_tables (rename_items = rename_items , settings = settings )
263+
264+ return await self ._pool .retry_operation (callee )
265+
161266
162267class TxContext (BaseTxContext ):
163268 async def __aenter__ (self ):
0 commit comments