Re: Spyce and SQL Alchemy Questions
Bruce Webber <[email protected]>
| Newsgroups | gmane.comp.python.spyce.general |
|---|---|
| Message-ID | <C95BAFD06DC4008552348B37@[10.9.30.130]> |
--Jonathan Ellis <[email protected]> wrote: > On Tue, 06 Jun 2006 12:05:41 -0400, "Bruce Webber" > <[email protected]> said: >> I created a small Spyce application for my team to enter project >> information into an SQLite database. I'm using SQL Alchemy to manage the >> database. [...] >> When I create an SQL Alchemy engine, session, metadata and mapping >> objects, >> these objects persist even after the Spyce page completes. To avoid >> attempting to recreate these objects (which results in an error), I'm >> using >> the Spyce pool module to store a "flag" which tells if the objects have >> been created. > > If you want a global session (and, as you noticed, you probably don't > :), rather than a pool + flags approach, it's more straightforward to > put your initialization code in your configuration .py file, which you > can then use as "from spyceConfig import ..." (No matter what your > config file is actually named, spyce references it as spyceConfig.) So if I understand correctly, my approach of using pool + flags is fine as long as I make sure each user has his own SQL Alchemy session object. Is that right? As always, thanks for your prompt and informative replies. -- Bruce Webber [email protected] http://brucewebber.us