tortoise / aerich

A database migrations tool for TortoiseORM, ready to production.
https://github.com/tortoise/aerich
Apache License 2.0
804 stars 90 forks source link

fix: update asyncio event loop policy on Windows #251

Open radluz opened 1 year ago

radluz commented 1 year ago

Fix for Windows incompatibility

On Windows, Psycopg is not compatible with the default ProactorEventLoop. Please use a different loop, for instance the SelectorEventLoop.

For instance, you can use, early in your program:

asyncio.set_event_loop_policy(
    asyncio.WindowsSelectorEventLoopPolicy()
)

Source: https://www.psycopg.org/psycopg3/docs/advanced/async.html