Re: [sqlalchemy] keeping long filter statements easily readable?

2012-05-28 Thread Simon King
On Sun, May 27, 2012 at 4:37 PM, Julien Lacroix ne...@aradriel.de wrote: I've stumbled across someof my old query and got certain problems to read my bunch of where statements. The editors word wrap function makes things just worse. whats your advance to keep long filter statements readable,

Re: [sqlalchemy] Session management with mod_wsgi and webapp2

2012-05-28 Thread Simon King
On Mon, May 28, 2012 at 12:58 AM, Bradley Mclain bradley.james.mcl...@gmail.com wrote: On Saturday, May 26, 2012 9:31:55 AM UTC+10, Michael Bayer wrote: On May 24, 2012, at 11:28 PM, Bradley Mclain wrote: Hi, Currently working on a project that use SQL alchemy with mod_wsgi,  webapp2 and

[sqlalchemy] Re: Lock table, do things to table, unlock table: Best way?

2012-05-28 Thread Jeff
The unique constraint sounds like a workable solution! I'll implement that with a try/except and report back if that was effective. Thanks! On May 28, 5:43 am, Simon King si...@simonking.org.uk wrote: On Sun, May 27, 2012 at 6:18 PM, Jeff jeffalst...@gmail.com wrote: Thanks, I have indeed

[sqlalchemy] Multiple inserts with .append()'d associations

2012-05-28 Thread Jeff
There are Analyses, which have Events. There's an Analysis_Event_Association table. Events are written before the Analyses. Later, I have a for loop calculating multiple Analyses. For each Analysis, we identify the Events it includes and append them, using sqlalchemy's relationship plumbing. This

Re: [sqlalchemy] Re: Lock table, do things to table, unlock table: Best way?

2012-05-28 Thread Michael Bayer
An option to add along to the unique constraint, if you expect to get collisions often, is to use a SAVEPOINT so that a process can roll back partially if this particular INSERT fails, then use the row. The Session offers SAVEPOINT via begin_nested(): session.begin_nested() try:

Re: [sqlalchemy] Multiple inserts with .append()'d associations

2012-05-28 Thread Michael Bayer
On May 28, 2012, at 10:52 AM, Jeff wrote: There are Analyses, which have Events. There's an Analysis_Event_Association table. Events are written before the Analyses. Later, I have a for loop calculating multiple Analyses. For each Analysis, we identify the Events it includes and append them,