flask-sqlalchemy
flask-sqlalchemy copied to clipboard
db.create_all shouldn't trigger intermediate commits
I can't figure out how to call db.create_all() without triggering intermediate commits after each table is created: http://stackoverflow.com/questions/34410091/flask-sqlalchemy-how-can-i-call-db-create-all-and-db-drop-all-without-trigg
Pretty sure vanilla SQLAlchemy doesn't have them in db.metadata.create_all.
I'm not sure which part of this library is actually triggering the commits, but I can't think of a reason they need to be there... the commits are causing problems for me because for some tests, I'd like to create some PostgreSQL tables within the same transaction, and then drop the transaction without committing.
If anyone has any idea what the root cause of the intermediate commits is, I'm happy to take a stab at fixing it.
Seems like you got answer for this in stackoverflow? The behavior cannot be changed in flask-sqlalchemy.
No, the SO answer indicates that for PostgreSQL this may be possible, and it's only for MySQL that this isn't possible due to MySQL's lack of transactional support for DDL.
This is a behavior of SQLAlchemy, it's not something we should address.