establishing only a subset of classes
as reflected.
+ - [bug] Scaled back the test applied within
+ flush() to check for UPDATE against partially
+ NULL PK within one table to only actually
+ happen if there's really an UPDATE to occur.
+ [ticket:2390]
+
0.7.5 (January 28, 2012)
=====
- orm
insert.append((state, state_dict, params, mapper,
connection, value_params, has_all_pks))
else:
- hasdata = False
+ hasdata = hasnull = False
for col in mapper._cols_by_table[table]:
if col is mapper.version_id_col:
params[col._label] = \
del params[col.key]
value = history.added[0]
params[col._label] = value
- if value is None and hasdata:
- raise sa_exc.FlushError(
- "Can't update table "
- "using NULL for primary key "
- "value")
+ if value is None:
+ hasnull = True
else:
hasdata = True
elif col in pks:
value = state.manager[prop.key].\
impl.get(state, state_dict)
if value is None:
- raise sa_exc.FlushError(
- "Can't update table "
- "using NULL for primary "
- "key value")
+ hasnull = True
params[col._label] = value
if hasdata:
+ if hasnull:
+ raise sa_exc.FlushError(
+ "Can't update table "
+ "using NULL for primary "
+ "key value")
update.append((state, state_dict, params, mapper,
connection, value_params))
"check that the database table allows generation ",
s.commit
)
+
+ def test_dont_complain_if_no_update(self):
+ T1 = self.classes.T1
+ s = Session()
+ t = T1(col1="1", col2=None)
+ s.add(t)
+ s.commit()
+
+ t.col1 = "1"
+ s.commit()
\ No newline at end of file