sqlalchemy - Stop random "Parent instance is not bound to a Session" -
i know simmilar questions have been answered here, thing is:
i have unit tests , run okay, "parent instance not bound session"
so how start debugging if happens randomly.
oh, , call before error db.session.add(my_item)
.
how happens? starting point put breakpoint of favorite python debugger (pdb) on line exception thrown. then, when encounter error inspect application state in python debugger, step in stack frames , figure out how application ended in such state.
also extensive use of python loggers , writing out debug
log level messages pinpoint actual cause of error.
Comments
Post a Comment