0

How can I check in flask shell the session_options like "expire_on_commit".

Further how can I set these options in flask-sqlalchemy. Referring to insightful - https://stackoverflow.com/a/12223711/631775

jethar
  • 2,223
  • 2
  • 22
  • 19

1 Answers1

0

From looking at the source code for Session (https://github.com/zzzeek/sqlalchemy/blob/master/lib/sqlalchemy/orm/session.py), the options which are passed to Session or sessionmaker, such as expire_on_commit, are just stored as attributes on the Session object.

I'm not overly familiar with flask shell but if you have access to the session object through the test request context at that point, or provision it some other way, you can inspect the session object directly for this info.

From http://flask.pocoo.org/docs/0.12/patterns/sqlalchemy/, Flask-SQLAlchemy uses a scoped session which allows each thread to have a unique session. You pass it a sessionmaker which you can configure to set the default configuration for all Sessions in your application.

Rach Sharp
  • 2,324
  • 14
  • 31