Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'AsyncAdapt_asyncpg_cursor' object has no attribute 'lastrowid' #11

Closed
dongfengweixiao opened this issue Mar 27, 2022 · 2 comments
Closed

Comments

@dongfengweixiao
Copy link

使用 postgresql+asyncpg 时,当插入数据时,能够正常写入数据库,但是客户端会提示内部错误,终端提示没有 lastrowid 的问题。
YB0R2~7ZXG){`) H T6G8Y8
AttributeError: 'AsyncAdapt_asyncpg_cursor' object has no attribute 'lastrowid'

如需更多有效信息,请告知

@amisadmin
Copy link
Owner

  • postgresql不支持插入的时候获取lastrowid, 版本v0.0.21已将此属性默认值None.
  • sqlalchemy有一个inserted_primary_key属性, 但是我尝试没有成功, 如果需要插入数据的时候返回id,你可以研究一下这个属性的用法,提供更好的解决方案.

@dongfengweixiao
Copy link
Author

版本v0.0.21已修复.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants