美文网首页我爱编程
2018-06-11 python-StatementError

2018-06-11 python-StatementError

作者: lucasdada | 来源:发表于2018-06-11 13:56 被阅读0次

StatementError: (sqlalchemy.exc.InvalidRequestError) Can't reconnect until invalid transaction is rolled back

声明错误,在无效的事务被回滚之前不能重连。

当session中已经有了主键为A的对象,再次尝试将主键为A的对象加载到同一个会话中会导致出现这种错误。
因为会话机制要保证同一个会话中只能有一个主键为A的对象。
参考:
http://docs.sqlalchemy.org/en/rel_1_1/orm/tutorial.html

相关文章

网友评论

    本文标题:2018-06-11 python-StatementError

    本文链接:https://www.haomeiwen.com/subject/snfheftx.html