Hello.

I have a client which has a collection of ClientProduct-s (ClientProduct has a
FK to Client). The following code:

    # Move some client products from a duplicate to the original.
    # Remove duplicate clients afterwards (in cascade).
    #
    # Note that client_map is a dict from a duplicate to its original.
    for each_duplicate, each_client in client_map.iteritems():
        for each_cp in each_duplicate.client_products:
            if some_condition(each_cp):
                each_cp.client = each_client
        session.delete(each_duplicate)
    session.flush()

deletes a client product that was moved from each_duplicate to each_client in
the inner loop. Why? What can I do to prevent it?


Thank you in advance,

Ladislav Lenart

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" 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/sqlalchemy?hl=en.

Reply via email to