How I can get the last inserted id?
Please, pay attention on the sqlalchemy
version, so this question isn't my case.
I tried:
async def foo(db_session: AsyncSession, login):
r1 = await db_session.execute(statement=models_users.insert().values(login=login))
r2 = await db_session.flush()
# r3 = await db_session.fetchval(...) # Error, no such method for async
r4 = await db_session.commit()
print(r2, r4, r1.fechone()) # None, None, None
print(r1.lastrowid) # 'AsyncAdapt_asyncpg_cursor' object has no attribute 'lastrowid'
SQLAlchemy 1.4.4
asyncpg 0.22.0