Код: Выделить всё
import asyncio
import psycopg
async def main():
async with await psycopg.AsyncConnection.connect('postgresql://xxxxxxxxxxx') as con:
async with con.cursor() as cur:
print(await cur.execute('select 1 a').fetchall())
if __name__ == '__main__':
asyncio.run(main())
Код: Выделить всё
psycopg.InterfaceError: Psycopg cannot use the 'ProactorEventLoop' to run in async mode. Please use a compatible event loop, for instance by setting 'asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())'
Подробнее здесь: https://stackoverflow.com/questions/712 ... nect-async
Мобильная версия