Skip to content

Commit c8b3d7b

Browse files
committed
Small connection docstring fixes
1 parent 0d265b9 commit c8b3d7b

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

python/psqlpy/_internal/__init__.pyi

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -751,11 +751,10 @@ class Connection:
751751
async def main() -> None:
752752
db_pool = PSQLPool()
753753
connection = await db_pool.connection()
754-
query_result: QueryResult = await connection.execute_many(
754+
await connection.execute_many(
755755
"INSERT INTO users (name, age) VALUES ($1, $2)",
756756
[["boba", 10], ["boba", 20]],
757757
)
758-
dict_result: List[Dict[Any, Any]] = query_result.result()
759758
```
760759
"""
761760
async def fetch_row(
@@ -788,10 +787,11 @@ class Connection:
788787
db_pool = PSQLPool()
789788
790789
connection = await db_pool.connection()
791-
fetched_row: SingleQueryResult = await connection.fetch_row(
792-
"SELECT * FROM users LIMIT 1",
793-
[],
790+
query_result: SingleQueryResult = await transaction.fetch_row(
791+
"SELECT username FROM users WHERE id = $1",
792+
[100],
794793
)
794+
dict_result: Dict[Any, Any] = query_result.result()
795795
```
796796
"""
797797
async def fetch_val(
@@ -821,8 +821,9 @@ class Connection:
821821
async def main() -> None:
822822
db_pool = PSQLPool()
823823
connection = await db_pool.connection()
824-
value: Any = await connection.fetch_val(
825-
"SELECT username FROM users WHERE id = $1",
824+
# this will be an int value
825+
query_result_value = await connection.fetch_row(
826+
"SELECT COUNT(*) FROM users WHERE id > $1",
826827
[100],
827828
)
828829
```

0 commit comments

Comments
 (0)