Replies: 3 comments 1 reply
-
Hi,
kinda, you can use the semi private
I'm personally -1 on doing the |
Beta Was this translation helpful? Give feedback.
-
I just tested the |
Beta Was this translation helpful? Give feedback.
-
Alright! I accept this workaround, works well... hopefully |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using SqlAlchemy with a Fast API application.
This application has a service layer, here's a simplified example:
I may use this service as follows:
Now my problem is that I would really love to use these services inside my alembic migrations, to perform "data migrations". Unfortunately, alembic doesn't support an async
upgrade
/downgrade
implementation.I've already configured alembic to use the async driver but this doesn't solve the problem of being able to call asynchronous code from within the
upgrade
functions.I've tried a few different approaches to overcome this, for instance, using nest-asyncio and spawning a "nested async I/O event loop" from inside
def upgrade()
, but I didn't like this approach because:nest-asyncio
because it does some unholy things.It seems like for this to work, alembic would need to expose an async API via MigrationContext, perhaps a separate, async version of
context.run_migrations
.Questions:
Beta Was this translation helpful? Give feedback.
All reactions