Given a simple declarative based class;
__tablename__ = 'brand'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(255), nullable=False)
entity = Entity()
entity.name = 'random name'
# Just by accessing the property name of the created object a
# SELECT statement is sent to the database.
By default, SQLAlchemy expires objects in the session when you commit. This is controlled via the
The reasoning behind this is that the row behind the instance could have been modified outside of the transaction, so if you are not careful you could run into data races, but if you know what you are doing you can safely turn it off.