From cf492ed7aa9345cfbbd4fef68c4db5871156f899 Mon Sep 17 00:00:00 2001 From: Martijn Pieters Date: Tue, 11 Oct 2022 13:39:45 +0100 Subject: [PATCH] AsyncSession: correct (stream_)scalars arg name (#238) The execute parameters argument is named 'params', not 'parameters'. See the [`AsyncSession.scalars()`][1] and [`AsyncSession.stream_scalars()`][2] implementations. Fixes #230 [1]: https://github.com/sqlalchemy/sqlalchemy/blob/a84f474051cae710e33b3d9486194ed534fe0167/lib/sqlalchemy/ext/asyncio/session.py#L249-L256 [2]: https://github.com/sqlalchemy/sqlalchemy/blob/a84f474051cae710e33b3d9486194ed534fe0167/lib/sqlalchemy/ext/asyncio/session.py#L338-L345 --- sqlalchemy-stubs/ext/asyncio/session.pyi | 8 ++++---- test/files/async_stuff.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sqlalchemy-stubs/ext/asyncio/session.pyi b/sqlalchemy-stubs/ext/asyncio/session.pyi index 6eaec8c..90a0cd2 100644 --- a/sqlalchemy-stubs/ext/asyncio/session.pyi +++ b/sqlalchemy-stubs/ext/asyncio/session.pyi @@ -135,13 +135,13 @@ class _AsyncSessionProtocol( async def scalars( self, statement: Executable, - parameters: Optional[_ExecuteParams] = ..., + params: Optional[_ExecuteParams] = ..., execution_options: Optional[_ExecuteOptions] = ..., ) -> ScalarResult: ... async def stream_scalars( self, statement: Executable, - parameters: Optional[_ExecuteParams] = ..., + params: Optional[_ExecuteParams] = ..., execution_options: Optional[_ExecuteOptions] = ..., ) -> AsyncScalarResult: ... async def delete(self, instance: Any) -> None: ... @@ -211,13 +211,13 @@ class _AsyncSessionTypingCommon( async def scalars( self, statement: Executable, - parameters: Optional[_ExecuteParams] = ..., + params: Optional[_ExecuteParams] = ..., execution_options: Optional[_ExecuteOptions] = ..., ) -> ScalarResult: ... async def stream_scalars( self, statement: Executable, - parameters: Optional[_ExecuteParams] = ..., + params: Optional[_ExecuteParams] = ..., execution_options: Optional[_ExecuteOptions] = ..., ) -> AsyncScalarResult: ... @classmethod diff --git a/test/files/async_stuff.py b/test/files/async_stuff.py index e956953..028bc1e 100644 --- a/test/files/async_stuff.py +++ b/test/files/async_stuff.py @@ -15,13 +15,13 @@ async def go() -> None: - r = await async_session.scalars(text("select 1")) + r = await async_session.scalars(text("select 1"), params=[]) r.first() - sr = await async_session.stream_scalars(text("select 1")) + sr = await async_session.stream_scalars(text("select 1"), params=[]) await sr.all() - r = await as_session.scalars(text("select 1")) + r = await as_session.scalars(text("select 1"), params=[]) r.first() - sr = await as_session.stream_scalars(text("select 1")) + sr = await as_session.stream_scalars(text("select 1"), params=[]) await sr.all() async with engine.connect() as conn: