Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,18 @@ async def driver(endpoint, database, event_loop):
yield driver

await driver.stop(timeout=10)


@pytest.fixture()
async def driver_sync(endpoint, database, event_loop):
driver_config = ydb.DriverConfig(
endpoint,
database,
)

driver = ydb.Driver(driver_config=driver_config)
driver.wait(timeout=15)

yield driver

driver.stop(timeout=10)
29 changes: 29 additions & 0 deletions tests/table/table_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import ydb


class TestTable:
def test_create_table_with_not_null_primary_key_by_api(self, driver_sync, database):
table_path = database + "/test_table"

def create_table(session: ydb.Session):
try:
session.drop_table(table_path)
except ydb.issues.SchemeError:
pass

description = (
ydb.TableDescription()
.with_primary_keys("key1")
.with_columns(
ydb.Column("key1", ydb.PrimitiveType.Uint64),
ydb.Column("value", ydb.OptionalType(ydb.PrimitiveType.Utf8)),
)
)

session.create_table(table_path, description)

with ydb.SessionPool(driver_sync) as pool:
pool.retry_operation_sync(create_table)

res = driver_sync.scheme_client.describe_path(table_path)
assert res.type == ydb.scheme.SchemeEntryType.TABLE