From: Eugene Toder Date: Tue, 5 Mar 2024 18:25:34 +0000 (-0500) Subject: Allow using AsyncEngine in compile X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e44a56f4cb37a2b57168ebf48a9b9683cd51a8ef;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Allow using AsyncEngine in compile This works, so only need to update the type annotation. --- diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py index 98f45d9dbf..a1536f99fa 100644 --- a/lib/sqlalchemy/sql/elements.py +++ b/lib/sqlalchemy/sql/elements.py @@ -116,6 +116,7 @@ if typing.TYPE_CHECKING: from ..engine.interfaces import CoreExecuteOptionsParameter from ..engine.interfaces import SchemaTranslateMapType from ..engine.result import Result + from ..ext.asyncio import AsyncEngine _NUMERIC = Union[float, Decimal] _NUMBER = Union[float, int, Decimal] @@ -246,7 +247,7 @@ class CompilerElement(Visitable): @util.preload_module("sqlalchemy.engine.url") def compile( self, - bind: Optional[Union[Engine, Connection]] = None, + bind: Optional[Union[Engine, AsyncEngine, Connection]] = None, dialect: Optional[Dialect] = None, **kw: Any, ) -> Compiled: