On May 23, 2012, at 5:04 AM, pr64 wrote:

> Hi,
> 
> Using SQLAlchemy 0.7.7 with an underlying sqlite databse, we
> configured the engine with poolclass=SingletonThreadPool and
> pool_size=50
> Our unit-tests were working fine. But when running the app, some
> (ProgrammingError) Cannot work on a closed database occured.
> Reading the docs and mailist archives, we tried to switch to NullPool
> which is the advised poolclass for sqlite.
> 
> It broke all our unit-test raising '(OperationalError) no such
> table: ...blabla...'

this sounds like you're using a :memory: database, if the effects of CREATE 
TABLE are being lost on a subsequent checkout.   NullPool can't be used with a 
memory database, since the entire database lasts for the duration of a single 
connection.   You'd need to stick with SingletonThreadPool or even StaticPool 
for that.

If this is in fact a file based database, I don't see anything obviously wrong 
with the code I'm seeing so the issue probably lies amongst more of the total 
picture of the fixtures + tests + configuration.   If the file is left over, 
you can look into it with the sqlite3 commandline tool to see that it contains 
the expected state, perhaps interactively as you pause the tests with inline 
pdb.set_trace() statements.


-- 
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.

Reply via email to