Skip to content

sqlalchemy.exc.MissingGreenlet: greenlet_spawn has not been called #1379

Closed Answered by zzzeek
bert2002 asked this question in Usage Questions
Discussion options

You must be logged in to vote

hi -

you are using a driver that only supports asyncio (aiomysql). The env.py you have above is written for a synchronous driver. Use a sync driver in your alembic script, such as mysqlclient or pymysql (see https://docs.sqlalchemy.org/en/20/dialects/mysql.html#module-sqlalchemy.dialects.mysql.mysqldb).

alternately, if you want to use an async driver in your alembic script, you would need to rework the env.py script to be compatible with this, see https://alembic.sqlalchemy.org/en/latest/cookbook.html#using-asyncio-with-alembic where you can choose from a pre-established template option or modify your env.py in place.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@bert2002
Comment options

Answer selected by bert2002
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants