On Jan 6, 2013, at 12:10 PM, Paul Johnston wrote:

> Hi,
> 
> I'm using zope.sqlalchemy in a web application (actually ToscaWidgets not 
> Zope) so each request is wrapped in a transaction. If the request succeeds 
> the transaction is committed; if there is an error it is rolled back. This 
> works great.
> 
> I have a log table where I log incoming XML to web callback methods (from 
> eBay, 3DCart, etc.) Now, if there is an error what I want to happen is most 
> things to be rolled back, but the log table still committed.
> 
> This has left me scratching my head a bit. Any ideas on an elegant way to do 
> this?

for this case you use a different Session, which you establish within the scope 
of the other one, add the state you want to it, and commit() it distinctly.   
Based on my limited experience with zope.transaction, this Session wouldn't 
even be using the zope.transaction extension so that it's own commit() method 
works normally.

the net effect of this is that your log operations occur on a different 
connection.   I use this pattern for log tables extensively.



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