On Wednesday, October 13, 2010 14:43:31 Juan Antonio Ibáñez wrote:
> Hello!
> 
>   I am trying to do some INSERT to my DB from one controller method. I
> do following try/except inside a loop:
> 
> try:
>   DBSession.add(importe)
>   DBSession.flush()
>   nimportados = nimportados + 1
> except Exception as ex:
>   nerroneos = nerroneos + 1
> 
> I need to check how many inserts are ok and how many with error. Using
> previous code I get following message when an exception occurs:
> 
> InvalidRequestError: The transaction is inactive due to a rollback in
> a subtransaction. Issue rollback() to cancel the transaction.
> 
> Is there any way to force insert for each add() call and to control

No. Use sub-transactions for that. I had that discussion with Michael Bayer 
before. He's adamant about this.

Diez

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en.

Reply via email to