On Oct 15, 11:37 am, "Heston James - Cold Beans"
<[EMAIL PROTECTED]> wrote:
> Quick question I hope guys.
>
> If I have an object which contains a bunch of children and cascade is set on
> the relationships. When I add the parent object to the session and commit
> it, are the children saved as part of a transaction by default? Or do I have
> to do something special?
>
Yes, nothing special needs to be done.

> If I catch any exceptions and use Rollback() on the committal, will all
> objects be rolled back? Of only the parent?
>
You would be within the same transaction, so everything would roll
back.
I did a quick test and confirmed against a pgdb.

Now, if you later grab the parent and delete it, it has potential to
leave those
unassociated children lying around, if you don't want that I use
cascade="all,delete-orphan"

> Many thanks guys, sorry if that seems like a dumb question but I just want
> to be sure.
>
> Cheers,
>
> Heston
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to