Re: [sqlalchemy] Not Expiring objects on rollbacks.

2011-07-25 Thread Moch Ramis
2011/7/23 Michael Bayer mike...@zzzcomputing.com On Jul 23, 2011, at 5:37 AM, Moch Ramis wrote: expunge() will remove any object from the Session This look a little dumb, but it seems this will solve my problem: expunged objects will not be expired by the session anymore and their data

Re: [sqlalchemy] Not Expiring objects on rollbacks.

2011-07-23 Thread Moch Ramis
expunge() will remove any object from the Session This look a little dumb, but it seems this will solve my problem: expunged objects will not be expired by the session anymore and their data will still be accessible don't they? (I'm not certaint about the last point)... I'm not sure what

[sqlalchemy] Not Expiring objects on rollbacks.

2011-07-22 Thread Moch Ramis
SQLAlchemy 7.1 I'm currently using sqlalchemy with a lot of begin/inserts/commits that allows me to make sure to have an atomic, stable save of my actions (but I only need a snapshot of my object at one time: my requests are consistent enough to avoid any database

Re: [sqlalchemy] Not Expiring objects on rollbacks.

2011-07-22 Thread Moch Ramis
2011/7/22 Michael Bayer mike...@zzzcomputing.com Here comes the problem: when an Integrity errors occurs, a rollback is done and every sqlalchemy records are expired, thus, the insert takes 3.42 seconds... and 3.41 seconds are spent on the restore snapshot function ... well the reason for

Re: [sqlalchemy] milions of expires and types mutability.

2011-07-01 Thread Moch Ramis
2011/6/30 Michael Bayer mike...@zzzcomputing.com 2011/6/30 Michael Bayer mike...@zzzcomputing.com This looks like you have 49000 calls to session.commit(), so, depending on what you're doing, I'd reduce the number of commit calls down to one, after the entire series of insert operations is

[sqlalchemy] milions of expires and types mutability.

2011-06-30 Thread Moch Ramis
SQAlchemy 0.7.1 / pyscopg 2.2.4 / PostgreSQL 8.4 -- Hello everyone. I recently profiled a task that was making an abusive use of inserts and queries through sqlalchemy after having requested 1094 objects from the

Re: [sqlalchemy] milions of expires and types mutability.

2011-06-30 Thread Moch Ramis
Thanks for your fast answer. 2011/6/30 Michael Bayer mike...@zzzcomputing.com This looks like you have 49000 calls to session.commit(), so, depending on what you're doing, I'd reduce the number of commit calls down to one, after the entire series of insert operations is complete.

Re: [sqlalchemy] Conditional insert in one transaction

2011-06-17 Thread Moch Ramis
2011/6/15 Michael Bayer mike...@zzzcomputing.com Assuming you're talking about the ORM. You can of course emit the exact SQL you refer to any time using execute() from an engine, connection, or session. The ORM works within a transaction at all times.so an expression like: myobject =

[sqlalchemy] Conditional insert in one transaction

2011-06-13 Thread Moch Ramis
Hello. I am trying to create a transaction that should insert a value depending of the result of a select. This should be done at once by the database in order to avoid some conflicts or duplicates. An equivalent sql version of the transaction would be : IF EXISTS (SELECT * FROM Table1 WHERE