1
1
# -*- coding: utf-8 -*-
2
- import os
3
-
2
+ import posixpath
4
3
import ydb
5
4
import basic_example_data
6
5
@@ -258,7 +257,7 @@ def callee(session):
258
257
259
258
def describe_table (pool , path , name ):
260
259
def callee (session ):
261
- result = session .describe_table (os . path .join (path , name ))
260
+ result = session .describe_table (posixpath .join (path , name ))
262
261
print ("\n > describe table: series" )
263
262
for column in result .columns :
264
263
print ("column, name:" , column .name , "," , str (column .type .item ).strip ())
@@ -277,7 +276,7 @@ def bulk_upsert(table_client, path):
277
276
.add_column ("air_date" , ydb .OptionalType (ydb .PrimitiveType .Uint64 ))
278
277
)
279
278
rows = basic_example_data .get_episodes_data_for_bulk_upsert ()
280
- table_client .bulk_upsert (os . path .join (path , "episodes" ), rows , column_types )
279
+ table_client .bulk_upsert (posixpath .join (path , "episodes" ), rows , column_types )
281
280
282
281
283
282
def is_directory_exists (driver , path ):
@@ -291,11 +290,11 @@ def ensure_path_exists(driver, database, path):
291
290
paths_to_create = list ()
292
291
path = path .rstrip ("/" )
293
292
while path not in ("" , database ):
294
- full_path = os . path .join (database , path )
293
+ full_path = posixpath .join (database , path )
295
294
if is_directory_exists (driver , full_path ):
296
295
break
297
296
paths_to_create .append (full_path )
298
- path = os . path .dirname (path ).rstrip ("/" )
297
+ path = posixpath .dirname (path ).rstrip ("/" )
299
298
300
299
while len (paths_to_create ) > 0 :
301
300
full_path = paths_to_create .pop (- 1 )
@@ -310,7 +309,7 @@ def run(endpoint, database, path):
310
309
311
310
ensure_path_exists (driver , database , path )
312
311
313
- full_path = os . path .join (database , path )
312
+ full_path = posixpath .join (database , path )
314
313
315
314
create_tables (pool , full_path )
316
315
0 commit comments