[sqlalchemy] Problem dealing with dropping tables while having objects in session

2011-01-09 Thread Arturo Sevilla
Hello, I've been trying to do unit testing with SQLAlchemy and PostgreSQL. In my model/tables I have two entities state and country, state has a foreign key relating to country (no problems there). In my setUp() method I call create_all() for my metadata while in tearDown() I call drop_all().

Re: [sqlalchemy] Problem dealing with dropping tables while having objects in session

2011-01-09 Thread Michael Bayer
Any access of session-bound objects after a commit() are going to access the database, which means the Session starts a new transaction. Close out the transactional resources held by your Session after each test ends. Otherwise PG maintains locks on each table that has been accessed in the