On Jun 13, 2010, at 4:03 AM, Faheem Mitha wrote:

> On Sat, 12 Jun 2010 19:58:28 -0400, Michael Bayer
> <mike...@zzzcomputing.com> wrote:
> 
>> this pattern:
>> 
>> try:
>>   foo()
>> except:
>>   pass
>> 
>> will get you killed every time.
> 
>> the difference in result is between the session's default of
>> transactionalized execution and the Connection's default of
>> "autocommit" execution.
> 
> Hi Mike,
> 
> Thanks for the quick reply, as usual.
> 
> I'm going to assume comment 1 and comment 2 are unrelated. If they
> aren't, please correct me.
> 
> As regards 1, I assume you mean try... pass... is a bad idea. I agree,
> but there is no


When an exception occurs in a transaction while Postgresql, you in most cases 
must issue a rollback() (that is what "(InternalError) current transaction is 
aborted, commands ignored until end of transaction block" means, thats a PG 
message).    Therefore you cannot attempt an operation with PG inside a 
transaction, have it fail, ignore the failure, then continue in the same 
transaction.    You need to roll the transaction back and start a new one, or 
use an autocommit mode which accomplishes the same thing.

> 
> As far as 2, I'm not sure what "transactionalized execution" is.

It means a statement is executed while a transaction is in progress.   Each 
subsequent statement occurs within the same transaction as the previous, until 
a rollback() or commit() is issued.  This is the opposite of "autocommit", 
where each statement occurs in a distinct transaction.


-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@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