On Wed, Aug 5, 2009 at 08:13, kportertx<kporte...@gmail.com> wrote:

> UGGG!  I have been fighting with this for a while.  I never thought to
> just use an actual file for my db instead of using memory.  I was
> using memory because I was only wanting to test things and didn't want
> to keep the data.  Seems that perhaps due to cherrypy the database was
> being deleted.  I later moved the create_all() statement into the
> index sub and found that it worked.  Following that when I loaded a
> lot of info into the db and browsed to an outside website and back all
> the data was gone.

In case you were wondering, the reason for all your troubles is
simple: cherrypy is multi-threaded. SQLite in-memory databases are
thread-local. If you call create_all in all your threads, you create
tables in all the different databases created by each thread. When you
later revisited your site, cherrypy served you the page through
another thread, hence another database, hence you saw no data.

-- 
Gaëtan de Menten
http://openhex.org

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