]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Allow using AsyncEngine in compile
authorEugene Toder <eltoder@users.noreply.github.com>
Tue, 5 Mar 2024 18:25:34 +0000 (13:25 -0500)
committerGitHub <noreply@github.com>
Tue, 5 Mar 2024 18:25:34 +0000 (13:25 -0500)
This works, so only need to update the type annotation.

lib/sqlalchemy/sql/elements.py

index 98f45d9dbf76ba745cc8a2820624d588529baa48..a1536f99fa1eefecc65cf622293526e129df1eda 100644 (file)
@@ -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: