Skip to content

Commit eecd8a9

Browse files
author
Boris Smidt
committed
Make the async code match the sync code, keep the asyncIterator so in the future we could reintroduce stream as a special version of many.
Fixes: #101
1 parent 53fa0b2 commit eecd8a9

17 files changed

Lines changed: 27 additions & 24 deletions

File tree

internal/endtoend/testdata/emit_pydantic_models/db/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Code generated by sqlc. DO NOT EDIT.
22
# versions:
3-
# sqlc v1.28.0
3+
# sqlc v1.31.1
44
import pydantic
55
from typing import Optional
66

internal/endtoend/testdata/emit_pydantic_models/db/query.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Code generated by sqlc. DO NOT EDIT.
22
# versions:
3-
# sqlc v1.28.0
3+
# sqlc v1.31.1
44
# source: query.sql
55
from typing import AsyncIterator, Iterator, Optional
66

@@ -103,8 +103,8 @@ async def get_author(self, *, id: int) -> Optional[models.Author]:
103103
)
104104

105105
async def list_authors(self) -> AsyncIterator[models.Author]:
106-
result = await self._conn.stream(sqlalchemy.text(LIST_AUTHORS))
107-
async for row in result:
106+
rows = (await self._conn.execute(sqlalchemy.text(LIST_AUTHORS))).all()
107+
for row in rows:
108108
yield models.Author(
109109
id=row[0],
110110
name=row[1],

internal/endtoend/testdata/emit_str_enum/db/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Code generated by sqlc. DO NOT EDIT.
22
# versions:
3-
# sqlc v1.28.0
3+
# sqlc v1.31.1
44
import dataclasses
55
import enum
66
from typing import Optional

internal/endtoend/testdata/emit_str_enum/db/query.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Code generated by sqlc. DO NOT EDIT.
22
# versions:
3-
# sqlc v1.28.0
3+
# sqlc v1.31.1
44
# source: query.sql
55
from typing import AsyncIterator, Iterator, Optional
66

@@ -102,8 +102,8 @@ async def get_book(self, *, id: int) -> Optional[models.Book]:
102102
)
103103

104104
async def list_books(self) -> AsyncIterator[models.Book]:
105-
result = await self._conn.stream(sqlalchemy.text(LIST_BOOKS))
106-
async for row in result:
105+
rows = (await self._conn.execute(sqlalchemy.text(LIST_BOOKS))).all()
106+
for row in rows:
107107
yield models.Book(
108108
id=row[0],
109109
title=row[1],

internal/endtoend/testdata/exec_result/python/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Code generated by sqlc. DO NOT EDIT.
22
# versions:
3-
# sqlc v1.28.0
3+
# sqlc v1.31.1
44
import dataclasses
55

66

internal/endtoend/testdata/exec_result/python/query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Code generated by sqlc. DO NOT EDIT.
22
# versions:
3-
# sqlc v1.28.0
3+
# sqlc v1.31.1
44
# source: query.sql
55
import sqlalchemy
66
import sqlalchemy.ext.asyncio

internal/endtoend/testdata/exec_rows/python/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Code generated by sqlc. DO NOT EDIT.
22
# versions:
3-
# sqlc v1.28.0
3+
# sqlc v1.31.1
44
import dataclasses
55

66

internal/endtoend/testdata/exec_rows/python/query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Code generated by sqlc. DO NOT EDIT.
22
# versions:
3-
# sqlc v1.28.0
3+
# sqlc v1.31.1
44
# source: query.sql
55
import sqlalchemy
66
import sqlalchemy.ext.asyncio

internal/endtoend/testdata/inflection_exclude_table_names/python/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Code generated by sqlc. DO NOT EDIT.
22
# versions:
3-
# sqlc v1.28.0
3+
# sqlc v1.31.1
44
import dataclasses
55

66

internal/endtoend/testdata/inflection_exclude_table_names/python/query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Code generated by sqlc. DO NOT EDIT.
22
# versions:
3-
# sqlc v1.28.0
3+
# sqlc v1.31.1
44
# source: query.sql
55
from typing import Optional
66

0 commit comments

Comments
 (0)