- attached selfreferential.py
Self-referential relation fails silently if an entity references itself
Issue #1457
resolved
(original reporter: ants) Self-referential relation fails silently if an entity references itself:
node = Node()
node.parent = node
session.add(node)
session.flush() # parent_id is inserted as None, no circular dependency error
Comments (7)
-
Account Deleted -
repo owner - changed milestone to 0.5.xx
This is a dupe of
#1449, and in response to that I added documentation at http://www.sqlalchemy.org/docs/05/mappers.html#rows-that-point-to-themselves-mutually-dependent-rows to explain what's going on here very explicitly.I'm not sure offhand how this condition could be detected unless its a simple "if child is obj and post_update is False" in dependency.py. not sure if that covers it.
-
repo owner although the failure here is not exactly silent. it complained loudly.
-
repo owner - marked as critical
-
repo owner - marked as major
-
repo owner - changed status to wontfix
this test case fails appropriately since the unit of work refactor in 0.6.
-
repo owner - changed milestone to 1.x.xx
- Log in to comment
(original author: ants) Example testcase