How to execute db.session.flush automatically by flask

after specifying the db.session.add, it is not actually sent to the database for execution. If you need to get the inserted id during session, you need to execute db.session.flush manually

is there any way to turn off this "feature" without manually performing any action that is automatically sent directly to the database server


you can check out the config.py in my project: https://github.com/eastossifrage/pyblog/blob/master/config.py

.
SQLALCHEMY_COMMIT_ON_TEARDOWN = True

this is what you want.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1be6684-39bb2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1be6684-39bb2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?