New issue 3815: session autoflush is not working
https://bitbucket.org/zzzeek/sqlalchemy/issues/3815/session-autoflush-is-not-working
miso:
I am working with **SQLAlchemy** and **Flask-SQLAlchemy** and when I add an object to the session, the session isn't auto flushed. When I add an object to the session, and `autoflush` is set to `True`, it supposed to send a INSERT operation in the outgoing transaction, right?
After I started getting this problem I made a clean virtual environment with **`SQLAlchemy (1.0.15)`** and a basic Flask application without **Flask-SQLAlchemy**. I created an engine and a basic session passing `autoflush=True` to `sessionmaker`. When I call **`session.add(instance)`**, again, the session isn't flushed automatically. I am unable to get an `id`. If I echo to the terminal, no database operation seems to happen.
**`session.autoflush`** is returning True. But I have to call **`session.flush()`** manually in order to get an `id` and actually send the INSERT statement.
I am missing something? About how autoflush is supposed to work?
|