In SqlAlchemy, how to ignore m2m relationship attributes when merge?

Posted by ablmf on Stack Overflow See other posts from Stack Overflow or by ablmf
Published on 2010-04-19T05:01:31Z Indexed on 2010/04/19 5:03 UTC
Read the original article Hit count: 257

Filed under:
|

There is a m2m relation in my models, User and Role.

I want to merge a role, but i DO NOT want this merge has any effect on user and role relation-ship. Unfortunately, for some complicate reason, role.users if not empty.

I tried to set role.users = None, but SA complains None is not a list.

At this moment, I use sqlalchemy.orm.attributes.del_attribute, but I don't know if it's provided for this purpose.

© Stack Overflow or respective owner

Related posts about sqlalchemy

Related posts about python