Just bumped into these questions which I still don't understand :-S

Chris Withers wrote:
I use setup/teardowns like this for this purpose (assume scoped_session, which yes you should probably use all the time so that the session is accessed by a single reference):

Where do you actually drop/create the tables?

def setup_for_rollback():
    Session.remove()

The docs on this are a little brief ;-)
http://www.sqlalchemy.org/docs/reference/orm/sessions.html#sqlalchemy.orm.scoping.ScopedSession.remove

This seems key to your suggested strategy. What does it do?

def teardown_for_rollback():
    transaction.rollback()
    Session.remove()
above, "transaction" is the "real" transaction. All begin/commits inside don't actually commit anything.

Again, this last bit escapes me, how come Session().commit() or begin doesn't do anything?

cheers,

Chris

--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to