[Sqlalchemy-tickets] Issue #3250: Setting None to a relation or id doesn't make it 'dirty' and the
Brought to you by:
zzzeek
|
From: Oleg P. <iss...@bi...> - 2014-11-13 14:57:56
|
New issue 3250: Setting None to a relation or id doesn't make it 'dirty' and the default is called for a column https://bitbucket.org/zzzeek/sqlalchemy/issue/3250/setting-none-to-a-relation-or-id-doesnt Oleg Pidsadnyi: Mike, I've encountered a behavior that is a bit unexpected: ``` #!python class Model(Base): a = Column(Integer, nullable=True, default=1) m = Model() m.a = None session.add(m) In: print m.a Out: None session.commit() In: print m.a Out: 1 ``` None is expected :( I understand that the configuration is silly, but this is the existing code. Setting None to the column doesn't cancel the default and the default thinks that the column wasn't set, so it uses the default value in the end. Responsible: zzzeek |