[Zope] Atomic ZSQL on Zope 2.7.5

Peter Bengtsson peter at fry-it.com
Thu Apr 27 10:04:40 EDT 2006


<a-wild-guess>
if you separate them as 3 separate ZSQL methods (or class attributes if 
you're using zsql via a python product) and try again, do you get the 
same unatomic behaviour?
</a-wild-guess>

I'm always using Postgresql databases and I've been using PoPy for the 
DA but now I'm always using ZPsycopgDA. Atomicity has never been a problem.

I'm not familiar with the eGenix mxODBC DA but perhaps you should 
contact it's author as well as the list.

Best of luck

Maslak, Michael wrote:
> For some reason I thought ZSQL method calls were atomic, but they appear 
> otherwise.
> 
>  
> 
> Using an eGenix mxODBC Database Connection at 
> /Database/PoPy_database_connection to a SQL Server 2000 back end, I have 
> created a Python script to write SQL commands and feed them in one large 
> string:
> 
>  
> 
> UPDATE equip SET workstation=1 WHERE eq_id=39315;
> 
>  
> 
> UPDATE node SET node='M28057' WHERE node_id=13451;
> 
>  
> 
> UPDATE materiel SET mat_nm='mm-M28057-H-01', owner='mmaslak', 
> datetime='2006/04/24 15:09:07.611 GMT-5' WHERE mat_id=39315;
> 
>  
> 
> This all gets sent as one string to a ZSQL method where the first two 
> commands execute, but the third fails because it doesn't like the 
> datetime string, which indeed fails when I try it alone in the PoPy 
> connection.  Why, oh why doesn't the whole thing fail like I might expect?
> 
>  
> 
> When I wrap the call in a 'begin transaction … commit', it becomes 
> atomic. Nothing happens if part of it fails. Great. 
> 
>  
> 
> But failure is not detectable by the Python script. I have used 
> try/except and if/else blocks to ascertain failure. It thinks a 
> non-commit is AOK, not an exception.  Is this function of the eGenix 
> ODBC? Of MS SQL Server 2K? Zope/ZSQL/Python?
> 
>  
> 
> How can I detect failure and maintain atomicity?
> 
>  
> 
>  
> 
> Michael Maslak, Jr.
> 
> Associate Software Engineer
> 
> Anteon Corporation
> 
> 294 Thames Ave
> 
> Bay St. Louis, MS  39520
> 
>  
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )

-- 
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com


More information about the Zope mailing list