While using SQLAlchemy, i add a object to a session using session.add(objname), then either explicitly flush it using session.flush or enable autoflush=True while creating the engine itself.
Now in the session, if want to return that object via session.query(classname).all(), i cannot retrieve it.
Why is that so? or is there a way in which query() can also retrieve flushed objects.
I can’t reproduce your issue. Please provide sample code that I can run to reproduce it.
Here’s code that does what you describe, but behaves as one would expect:
After that setup, Add a new user:
Then query it back: