From e44a56f4cb37a2b57168ebf48a9b9683cd51a8ef Mon Sep 17 00:00:00 2001 From: Eugene Toder Date: Tue, 5 Mar 2024 13:25:34 -0500 Subject: [PATCH] Allow using AsyncEngine in compile This works, so only need to update the type annotation. --- lib/sqlalchemy/sql/elements.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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: -- 2.47.2