Advertisement
popov-aa

Untitled

Nov 3rd, 2024
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.88 KB | None | 0 0
  1. import os
  2. import ydb
  3.  
  4. config = ydb.DriverConfig(
  5.     endpoint="grpc://ydb-local:2136",
  6.     database="/local",
  7. )
  8.  
  9. credentials = ydb.StaticCredentials(
  10.     driver_config=config,
  11.     user="root",
  12.     password="1234"
  13. )
  14.  
  15. with ydb.Driver(driver_config=config, credentials=credentials) as driver:
  16.     driver.wait(timeout=5)
  17.  
  18.     with ydb.SessionPool(driver) as pool:
  19.         def callee(session):
  20.             session.execute_scheme(
  21.                 """
  22.                    CREATE table `seasons` (
  23.                        `series_id` Uint64,
  24.                        `season_id` Uint64,
  25.                        `title` Utf8,
  26.                        `first_aired` Uint64,
  27.                        `last_aired` Uint64,
  28.                        PRIMARY KEY (`series_id`, `season_id`)
  29.                    )
  30.                """
  31.             )
  32.         pool.retry_operation_sync(callee)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement