You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importasynciofromaiopg.saimportcreate_engineimportsqlalchemyassametadata=sa.MetaData()
tbl=sa.Table('tbl', metadata,
sa.Column('id', sa.Integer, primary_key=True),
sa.Column('val', sa.String(255)))
asyncdefcreate_table(engine):
asyncwithengine.acquire() asconn:
awaitconn.execute('DROP TABLE IF EXISTS tbl')
awaitconn.execute('''CREATE TABLE tbl ( id serial PRIMARY KEY, val varchar(255))''')
asyncdefgo():
asyncwithcreate_engine(user='postgres',
database='aiopg',
host='127.0.0.1',
password='postgres') asengine:
asyncwithengine.acquire() asconn:
awaitconn.execute(tbl.insert().values(val='abc'))
asyncforrowinconn.execute(tbl.select()):
print(row.id, row.val)
loop=asyncio.get_event_loop()
loop.run_until_complete(go())
And get the following error:
Traceback (most recent call last): File "my_script.py", line 109, in <module> loop.run_until_complete(go()) File "C:\Python\Python3\lib\asyncio\base_events.py", line 616, in run_until_complete return future.result() File "my_script.py", line 97, in go async with create_engine(user='postgres', File "C:\Python\Python3\lib\site-packages\aiopg\utils.py", line 94, in __aenter__ self._obj = await self._coro File "C:\Python\Python3\lib\site-packages\aiopg\sa\engine.py", line 69, in _create_engine pool = await aiopg.create_pool( File "C:\Python\Python3\lib\site-packages\aiopg\pool.py", line 155, in from_pool_fill await self._fill_free_pool(False) File "C:\Python\Python3\lib\site-packages\aiopg\pool.py", line 193, in _fill_free_pool conn = await connect( File "C:\Python\Python3\lib\site-packages\aiopg\connection.py", line 38, in connect coro = Connection( File "C:\Python\Python3\lib\site-packages\aiopg\connection.py", line 92, in __init__ self._loop.add_reader(self._fileno, self._ready, self._weakref) File "C:\Python\Python3\lib\asyncio\events.py", line 501, in add_reader raise NotImplementedErrorNotImplementedErrorException ignored in: <function Connection.__del__ at 0x03DD7DF0>Traceback (most recent call last): File "C:\Python\Python3\lib\site-packages\aiopg\connection.py", line 512, in __del__ File "C:\Python\Python3\lib\site-packages\aiopg\connection.py", line 310, in close File "C:\Python\Python3\lib\site-packages\aiopg\connection.py", line 285, in _close File "C:\Python\Python3\lib\asyncio\events.py", line 504, in remove_readerNotImplementedError: Process finished with exit code 1
I think it is due to invalid port, but I have not found how to set port number ...
I tried:
Hi all,
I have tried to run the following code:
And get the following error:
I think it is due to invalid port, but I have not found how to set port number ...
I tried:
But it did not helped (
The text was updated successfully, but these errors were encountered: