the default value is True, indicating a weak
referencing map in use.
+ - Fixed a unit of work issue whereby the foreign
+ key attribute on an item contained within a collection
+ owned by an object being deleted would not be set to
+ None if the relation() was self-referential. [ticket:1376]
+
- sql
- ``sqlalchemy.extract()`` is now dialect sensitive and can
extract components of timestamps idiomatically across the
def execute_save_steps(self, trans, task):
self.save_objects(trans, task)
+ for dep in task.polymorphic_cyclical_dependencies:
+ self.execute_dependency(trans, dep, False)
+ for dep in task.polymorphic_cyclical_dependencies:
+ self.execute_dependency(trans, dep, True)
self.execute_cyclical_dependencies(trans, task, False)
self.execute_dependencies(trans, task)
self.execute_dependency(trans, dep, True)
def execute_cyclical_dependencies(self, trans, task, isdelete):
- for dep in task.polymorphic_cyclical_dependencies:
- self.execute_dependency(trans, dep, isdelete)
for t in task.dependent_tasks:
self.execute(trans, [t], isdelete)
sess.delete(a)
sess.flush()
-
+ @testing.resolve_artifact_names
+ def test_setnull_ondelete(self):
+ mapper(C1, t1, properties={
+ 'children':relation(C1)
+ })
+
+ sess = create_session()
+ c1 = C1()
+ c2 = C1()
+ c1.children.append(c2)
+ sess.add(c1)
+ sess.flush()
+ assert c2.parent_c1 == c1.c1
+
+ sess.delete(c1)
+ sess.flush()
+ assert c2.parent_c1 is None
+
+ sess.expire_all()
+ assert c2.parent_c1 is None
+
class SelfReferentialNoPKTest(_base.MappedTest):
"""A self-referential relationship that joins on a column other than the primary key column"""