|
1 | 1 | # Code generated by sqlc. DO NOT EDIT.
|
2 | 2 | # versions:
|
3 |
| -# sqlc v1.28.0 |
| 3 | +# sqlc v1.29.0 |
4 | 4 | # source: query.sql
|
5 |
| -from typing import AsyncIterator, Iterator, Optional |
| 5 | +from typing import Any, AsyncIterator, Iterator, List, Optional |
6 | 6 |
|
7 | 7 | import sqlalchemy
|
8 | 8 | import sqlalchemy.ext.asyncio
|
|
20 | 20 | """
|
21 | 21 |
|
22 | 22 |
|
| 23 | +CREATE_AUTHORS_BATCH = """-- name: create_authors_batch \\:copyfrom |
| 24 | +INSERT INTO authors (name, bio) VALUES (:p1, :p2) |
| 25 | +""" |
| 26 | + |
| 27 | + |
23 | 28 | DELETE_AUTHOR = """-- name: delete_author \\:exec
|
24 | 29 | DELETE FROM authors
|
25 | 30 | WHERE id = :p1
|
@@ -52,6 +57,10 @@ def create_author(self, *, name: str, bio: Optional[str]) -> Optional[models.Aut
|
52 | 57 | bio=row[2],
|
53 | 58 | )
|
54 | 59 |
|
| 60 | + def create_authors_batch(self, arg_list: List[Any]) -> int: |
| 61 | + result = self._conn.executemany(sqlalchemy.text(CREATE_AUTHORS_BATCH), arg_list) |
| 62 | + return result.rowcount |
| 63 | + |
55 | 64 | def delete_author(self, *, id: int) -> None:
|
56 | 65 | self._conn.execute(sqlalchemy.text(DELETE_AUTHOR), {"p1": id})
|
57 | 66 |
|
@@ -89,6 +98,10 @@ async def create_author(self, *, name: str, bio: Optional[str]) -> Optional[mode
|
89 | 98 | bio=row[2],
|
90 | 99 | )
|
91 | 100 |
|
| 101 | + async def create_authors_batch(self, arg_list: List[Any]) -> int: |
| 102 | + result = await self._conn.executemany(sqlalchemy.text(CREATE_AUTHORS_BATCH), arg_list) |
| 103 | + return result.rowcount |
| 104 | + |
92 | 105 | async def delete_author(self, *, id: int) -> None:
|
93 | 106 | await self._conn.execute(sqlalchemy.text(DELETE_AUTHOR), {"p1": id})
|
94 | 107 |
|
|
0 commit comments