diff options
author | Federico Caselli <cfederico87@gmail.com> | 2023-04-29 23:25:21 +0200 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-05-12 12:06:14 -0400 |
commit | 6d2df6c92c981d220bd1481ebdc7d86274ccf845 (patch) | |
tree | be009a39f769dd4cff23d1fd917f651adeccee72 /tools | |
parent | 92e54a0e1c96cecd99397cb1aee9c3bb28f780c6 (diff) | |
download | alembic-6d2df6c92c981d220bd1481ebdc7d86274ccf845.tar.gz |
Added ``op.run_async``.
Added :meth:`.Operations.run_async` to the operation module to allow
running async functions in the ``upgrade`` or ``downgrade`` migration
function when running alembic using an async dialect.
This function will receive as first argument an
class:`~sqlalchemy.ext.asyncio.AsyncConnection` sharing the transaction
used in the migration context.
also restore the .execute() method to BatchOperations
Fixes: #1231
Change-Id: I3c3237d570be3c9bd9834e4c61bb3231bfb82765
Diffstat (limited to 'tools')
-rw-r--r-- | tools/write_pyi.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/write_pyi.py b/tools/write_pyi.py index 7d24870..82ceead 100644 --- a/tools/write_pyi.py +++ b/tools/write_pyi.py @@ -28,7 +28,6 @@ if True: # avoid flake/zimports messing with the order from alembic.operations import ops import sqlalchemy as sa - TRIM_MODULE = [ "alembic.runtime.migration.", "alembic.operations.base.", @@ -179,9 +178,12 @@ def _generate_stub_for_meth( retval = repr(annotation).replace("typing.", "") elif isinstance(annotation, type): retval = annotation.__qualname__ + elif isinstance(annotation, typing.TypeVar): + retval = annotation.__name__ else: retval = annotation + retval = retval.replace("~", "") # typevar repr as "~T" for trim in TRIM_MODULE: retval = retval.replace(trim, "") @@ -371,6 +373,7 @@ cls_ignore = { "inline_literal", "invoke", "register_operation", + "run_async", } cases = [ |