Re: [sqlalchemy] [Q] Move elements in one-to-many relationship to a new owner

2012-11-13 Thread Ladislav Lenart
Hello. I was unable to reproduce the problem on your test example. I THINK it does exactly what my problematic code does. It seems that either the problem is more elaborate (but I don't see it) or I have a bug somewhere in my code. However my simple workaround works, so I consider the problem

Re: [sqlalchemy] [Q] Move elements in one-to-many relationship to a new owner

2012-11-09 Thread Ladislav Lenart
Hello. I managed to solve my problem. I use session.execute(...) instead of session.delete(), because the second form deletes more things than it should. The working code is: # Move some client products from a duplicate to the original. # Remove duplicate clients afterwards (in cascade).

Re: [sqlalchemy] [Q] Move elements in one-to-many relationship to a new owner

2012-11-09 Thread Michael Bayer
there's no mapping or code example provided here, which makes a condition like this extremely difficult to diagnose, however I've prepared a test script that takes its best guess as to configuration, that is, a client_products collection with a client backref, and a cascade of all,