Re: [sqlalchemy] Disable relationship deassociation

2016-11-06 Thread mike bayer
On 11/05/2016 08:45 PM, Yegor Roganov wrote: Thank, I haven't yet figured out how to make your code more general (without having to specify 'user_id'), but I think it can be done. In the meantime I came up with a somewhat gross solution of my own. The idea is to declare relation as

Re: [sqlalchemy] Disable relationship deassociation

2016-11-05 Thread Yegor Roganov
Thank, I haven't yet figured out how to make your code more general (without having to specify 'user_id'), but I think it can be done. In the meantime I came up with a somewhat gross solution of my own. The idea is to declare relation as `viewonly=True` and to delegate sets to an injected

Re: [sqlalchemy] Disable relationship deassociation

2016-11-05 Thread mike bayer
On 11/05/2016 02:45 PM, Yegor Roganov wrote: Hello, For 1-to-1 model relationships, when relationship value is updated, the default SQLAlchemy behavior is to set the foreign key column of previous relationship value to NULL. I would like to configure SQLAlchemy to not set the foreign key

[sqlalchemy] Disable relationship deassociation

2016-11-05 Thread Yegor Roganov
Hello, For 1-to-1 model relationships, when relationship value is updated, the default SQLAlchemy behavior is to set the foreign key column of previous relationship value to NULL. I would like to configure SQLAlchemy to not set the foreign key column to NULL, but instead to set a `deleted`