Skip to content
This repository was archived by the owner on Aug 19, 2025. It is now read-only.

Commit 56e2605

Browse files
Fix up type annotations
1 parent e0dc14b commit 56e2605

4 files changed

Lines changed: 6 additions & 7 deletions

File tree

databases/backends/mysql.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ async def release(self) -> None:
8383
await self._database._pool.release(self._connection)
8484
self._connection = None
8585

86-
async def fetch_all(self, query: ClauseElement) -> typing.List[RowProxy]:
86+
async def fetch_all(self, query: ClauseElement) -> typing.List[typing.Mapping]:
8787
assert self._connection is not None, "Connection is not acquired"
8888
query, args, context = self._compile(query)
8989
cursor = await self._connection.cursor()
@@ -98,7 +98,7 @@ async def fetch_all(self, query: ClauseElement) -> typing.List[RowProxy]:
9898
finally:
9999
await cursor.close()
100100

101-
async def fetch_one(self, query: ClauseElement) -> typing.Optional[RowProxy]:
101+
async def fetch_one(self, query: ClauseElement) -> typing.Optional[typing.Mapping]:
102102
assert self._connection is not None, "Connection is not acquired"
103103
query, args, context = self._compile(query)
104104
cursor = await self._connection.cursor()

databases/backends/postgres.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,13 @@ async def release(self) -> None:
111111
self._connection = await self._database._pool.release(self._connection)
112112
self._connection = None
113113

114-
async def fetch_all(self, query: ClauseElement) -> typing.List[Record]:
114+
async def fetch_all(self, query: ClauseElement) -> typing.List[typing.Mapping]:
115115
assert self._connection is not None, "Connection is not acquired"
116116
query, args, result_columns = self._compile(query)
117117
rows = await self._connection.fetch(query, *args)
118118
return [Record(row, result_columns, self._dialect) for row in rows]
119119

120-
async def fetch_one(self, query: ClauseElement) -> typing.Optional[Record]:
120+
async def fetch_one(self, query: ClauseElement) -> typing.Optional[typing.Mapping]:
121121
assert self._connection is not None, "Connection is not acquired"
122122
query, args, result_columns = self._compile(query)
123123
row = await self._connection.fetchrow(query, *args)

databases/backends/sqlite.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ async def release(self) -> None:
7979
await self._pool.release(self._connection)
8080
self._connection = None
8181

82-
async def fetch_all(self, query: ClauseElement) -> typing.List[RowProxy]:
82+
async def fetch_all(self, query: ClauseElement) -> typing.List[typing.Mapping]:
8383
assert self._connection is not None, "Connection is not acquired"
8484
query, args, context = self._compile(query)
8585

@@ -91,7 +91,7 @@ async def fetch_all(self, query: ClauseElement) -> typing.List[RowProxy]:
9191
for row in rows
9292
]
9393

94-
async def fetch_one(self, query: ClauseElement) -> typing.Optional[RowProxy]:
94+
async def fetch_one(self, query: ClauseElement) -> typing.Optional[typing.Mapping]:
9595
assert self._connection is not None, "Connection is not acquired"
9696
query, args, context = self._compile(query)
9797

tests/test_databases.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ async def test_fetch_one_returning_no_results(database_url):
190190
assert result is None
191191

192192

193-
194193
@pytest.mark.parametrize("database_url", DATABASE_URLS)
195194
@async_adapter
196195
async def test_execute_return_val(database_url):

0 commit comments

Comments
 (0)