diff options
author | waleriya <waleriya@yandex-team.com> | 2023-04-07 16:24:32 +0300 |
---|---|---|
committer | waleriya <waleriya@yandex-team.com> | 2023-04-07 16:24:32 +0300 |
commit | e5ecbf8573a6bcc2b2193dead9e7299994c28db1 (patch) | |
tree | 9def85ed4c77b70e03480203b8dc81fd0cc6a058 | |
parent | 200196d273767acf35f66bdb1be01bb80121179f (diff) | |
download | ydb-e5ecbf8573a6bcc2b2193dead9e7299994c28db1.tar.gz |
ydb docs: add recipe for driver init
-rw-r--r-- | ydb/docs/ru/core/reference/ydb-sdk/recipes/init.md | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/ydb/docs/ru/core/reference/ydb-sdk/recipes/init.md b/ydb/docs/ru/core/reference/ydb-sdk/recipes/init.md index 798c35242cb..cdcd363b6f8 100644 --- a/ydb/docs/ru/core/reference/ydb-sdk/recipes/init.md +++ b/ydb/docs/ru/core/reference/ydb-sdk/recipes/init.md @@ -95,7 +95,30 @@ description: "В статье приведены примеры кода под - Java - {% include [work in progress message](_includes/addition.md) %} +- Python + + ```python + import ydb + + with ydb.Driver(connection_string="grpc://localhost:2136?database=/local") as driver: + driver.wait(timeout=5, fail_fast=True) + ... + ``` + +- Python (asyncio) + + ```python + import ydb + import asyncio + + async def ydb_init(): + async with ydb.aio.Driver(endpoint="grpc://localhost:2136", database="/local") as driver: + await driver.wait(fail_fast=True) + ... + + asyncio.run(ydb_init()) + ``` + {% endlist %} |