[QUESTION] Run migrations in conftest - fastapi #871
-
Hi, I'm trying to make a project in fastapi and I would like to run all migrations in an asynchronous function in my conftest, is there any way to do this? Or would there be some way to build a fixture sync that does this job? https://github.com/jonatasoli/fastapi-design-api-example/blob/main/app/conftest.py I try
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
see #870 for background on this issue. short answer, running migrations using asyncio is unnecessary and it's much easier to use a normal DBAPI driver for your migrations. |
Beta Was this translation helpful? Give feedback.
-
oh oh sorry, I also forgot we have an async template as an example, which illustrates how to use run_sync: https://github.com/sqlalchemy/alembic/blob/master/alembic/templates/async/env.py |
Beta Was this translation helpful? Give feedback.
see #870 for background on this issue.
short answer, running migrations using asyncio is unnecessary and it's much easier to use a normal DBAPI driver for your migrations.