I have some items which are related but I need to change it so they related to another item.
Before getting myself in a mess (as I need to do this for a bunch of tables) I wanted to check if the following approach is fine. I am using SA 0.5, ORM and declarative and the model is: class Cbbottle(Base): __table__ = sa.Table(u'cbbottle', metadata, sa.Column(u'cbbottleid', sa.Integer(), sa.Sequence('gen_cbbottle_cbbottleid'), primary_key=True, nullable=False), etc ) purchase = sao.relation('Purchase', cascade="all, delete, delete-orphan", backref='cbbottle') aItem = session.query(db.Cbbottle).get(keyno) bItem = session.query(db.Cbbottle).get(anotherkeyno) for purchase in aItem.purchase: purchase.cbbottle = bItem session.commit() At this point I expect that aItem has no more "purchase" relations and they are all related to bItem. Werner --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---