Re: [sqlalchemy] Updating children of a one-to-many bi-directional relationship

2014-07-22 Thread Bala Ramakrishnan
Hi Michael, thanks for the reply. I thought I had tested the code, but I did not do so properly. The essence of the logic I posted works. Here are the few corrections: You are right that I should not use strings for partition_id when it is defined as integer. This is a piece of test code I cook

Re: [sqlalchemy] Updating children of a one-to-many bi-directional relationship

2014-07-21 Thread Michael Bayer
not to mention you're using strings to set integer values, again a bad idea, can only confuse your database: part.partition_id = '345' # <-- this is a string partition_id = sa.Column(sa.Integer, nullable=False) # <-- should be integer with this program you need to create a short test case th

Re: [sqlalchemy] Updating children of a one-to-many bi-directional relationship

2014-07-21 Thread Michael Bayer
the code there doesn't seem to show anything that would result in any DELETEs emitted. a DELETE here would only occur if you deassociated a TestDevice and a TestPartition by removing from the TestDevice.partitions collection or setting a TestPartition.device to None, and I don't see that. Al

[sqlalchemy] Updating children of a one-to-many bi-directional relationship

2014-07-20 Thread Bala Ramakrishnan
I had asked this question on Stack Overflow. The details are at this link: http://stackoverflow.com/questions/24836816/updating-a-few-children-in-one-to-many-relationship-deletes-all-rows-and-adds-ne The summary is I have a parent class A and a bidirectional one-to-many relationship with class B