Using autoflush with SQLAlchemy?

0 views
Skip to first unread message

Bobby Impollonia

unread,
Mar 28, 2008, 1:28:17 PM3/28/08
to TurboGears
If I am using SQLAlchemy with tg, is there a way to set the autoflush
and transactional attributes for my session?

I see that in database.py, sqlalchemy.orm.create_session is always
called with no arguments. As far as I know, the only way to set
transactional and autoflush is to pass them as kw arguments to this
function, so it looks like the sessions created by tg can't have these
attributes? DB config options in the cfg file end up getting passed to
sqlalchemy.create_engine and you can't set these options there, nor
can they go in the dburi (as far as I can tell).

As a side note, can someone explain why I wouldn't want autoflush? As
I understand it, autoflush flushes pending c/u/d operations
immediately before the next query, so it seems like the only extra
power you gain from not using it is the ability to query against dirty
data?
Reply all
Reply to author
Forward
0 new messages