@@ -6,42 +6,44 @@ Python DBAPI to `YDB`, which provides both sync and async drivers and complies w
66
77## Installation
88
9- ** TBD after first release**
9+ ``` shell
10+ pip install ydb-dbapi
11+ ```
1012
1113## Usage
1214
1315To establish a new DBAPI connection you should provide ` host ` , ` port ` and ` database ` :
1416
15- ```python
16- import ydb_dbapi
17+ ``` python
18+ import ydb_dbapi
1719
18- connection = ydb_dbapi.connect(
19- host="localhost", port="2136", database="/local"
20- ) # sync connection
20+ connection = ydb_dbapi.connect(
21+ host = " localhost" , port = " 2136" , database = " /local"
22+ ) # sync connection
2123
22- async_connection = await ydb_dbapi.async_connect(
23- host="localhost", port="2136", database="/local"
24- ) # async connection
25- ```
24+ async_connection = await ydb_dbapi.async_connect(
25+ host = " localhost" , port = " 2136" , database = " /local"
26+ ) # async connection
27+ ```
2628
2729Usage of connection:
2830
29- ```python
30- with connection.cursor() as cursor:
31- cursor.execute("SELECT id, val FROM table")
31+ ``` python
32+ with connection.cursor() as cursor:
33+ cursor.execute(" SELECT id, val FROM table" )
3234
33- row = cursor.fetchone()
34- rows = cursor.fetchmany(size=5)
35- rows = cursor.fetchall()
36- ```
35+ row = cursor.fetchone()
36+ rows = cursor.fetchmany(size = 5 )
37+ rows = cursor.fetchall()
38+ ```
3739
3840Usage of async connection:
3941
40- ```python
41- async with async_connection.cursor() as cursor:
42- await cursor.execute("SELECT id, val FROM table")
42+ ``` python
43+ async with async_connection.cursor() as cursor:
44+ await cursor.execute(" SELECT id, val FROM table" )
4345
44- row = await cursor.fetchone()
45- rows = await cursor.fetchmany(size=5)
46- rows = await cursor.fetchall()
47- ```
46+ row = await cursor.fetchone()
47+ rows = await cursor.fetchmany(size = 5 )
48+ rows = await cursor.fetchall()
49+ ```
0 commit comments