use Session.remove() which will remove any existing session entirely. the next call to the scoped session will create a brand new session.
iain duncan wrote: > > Hi folks, I'm working on a set of test utilities for functional tests > using SA. Because they use a turbogears model, they import the tg > model and so get the SA class definitions with the mappers from the TG > scoped_session. My problem is that I want to reseed this data on each > test. So I have a fixture setup that drops and recreates the tables > used, and then it's supposed to put my seed data into the db for each > test. The problem is that once the seed data objects ( instantiated > model objects) have gone through this once, they won't do it again > because the the objects identites conflict with persistent objects in > the scoped_session. I don't seem to be able to completely clean out > the session in order to resave the objects. Can anyone give me any > tips on how I can: > > - create a model object > - save it to the scoped session > - flush the session > - wipe out the whole mess *except* the model object > - resave and reflush those same objects again and again > > Much appreciated, > Iain > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@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 -~----------~----~----~----~------~----~------~--~---