Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does db.session.commit() terminate a SQLAlchemy session?

Tags:

sqlalchemy

Does db.session.commit() terminate a SQLAlchemy session?

I suspect the answer is no, and that I have to additionally call db.session.close(), but wanted to confirm.

like image 624
Jeff Widman Avatar asked Jan 20 '26 08:01

Jeff Widman


1 Answers

No, it doesn't. It commits the current transaction. You can still issue additional queries after you commit. A transaction will be started automatically if you do. The relevant documentation is here.

like image 188
univerio Avatar answered Jan 23 '26 11:01

univerio



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!