Ahh, that looks like it might help!

After I use begin_nested(), does the next commit() commit the nested changes to 
the database, or does it commit them back to the outer session?


-----Original Message-----
From: sqlalchemy@googlegroups.com [mailto:sqlalchemy@googlegroups.com] On 
Behalf Of Wichert Akkerman
Sent: Monday, 23 January 2012 6:44 PM
To: sqlalchemy@googlegroups.com
Subject: Re: [sqlalchemy] Anticipating an IntegrityError before it happens (or 
noticing it immediately after)

On 2012-1-23 03:23, Jackson, Cameron wrote:
> Anyway, it kind of looks to me like any attempt to do this in some sort
> of clever automatic way is going to be more trouble than its worth, so I
> think I'll just bite the bullet and put backrefs on all of the
> relationships that are going to the table in question, and then just
> check all of the backrefs before deletion. This was always the most
> obvious solution to me, but I was hoping for some perfect magical
> function that would do it automatically. One can dream! :)

Doing this by hand is always going to be complex and error-prone I would 
expect. If your backend support it you might be able to get away with 
using savepoints (see 
http://www.sqlalchemy.org/docs/orm/session.html#using-savepoint ).

Wichert.

-- 
Wichert Akkerman <wich...@wiggy.net>   It is simple to make things.
http://www.wiggy.net/                  It is hard to make things simple.

-- 
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.



-------------------------------------------------------------------------
DISCLAIMER: This e-mail transmission and any documents, files and 
previous e-mail messages attached to it are private and confidential.  
They may contain proprietary or copyright material or information that 
is subject to legal professional privilege.  They are for the use of 
the intended recipient only.  Any unauthorised viewing, use, disclosure, 
copying, alteration, storage or distribution of, or reliance on, this 
message is strictly prohibited.  No part may be reproduced, adapted or 
transmitted without the written permission of the owner.  If you have 
received this transmission in error, or are not an authorised recipient, 
please immediately notify the sender by return email, delete this 
message and all copies from your e-mail system, and destroy any printed 
copies.  Receipt by anyone other than the intended recipient should not 
be deemed a waiver of any privilege or protection.  Thales Australia 
does not warrant or represent that this e-mail or any documents, files 
and previous e-mail messages attached are error or virus free.  

-------------------------------------------------------------------------

-- 
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