]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
- Further refined 0.5.1's warning about delete-orphan cascade
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 20 Jan 2009 21:35:57 +0000 (21:35 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 20 Jan 2009 21:35:57 +0000 (21:35 +0000)
commit7c56371f81707b5979249b2f2b056f65488f1bab
tree3d2d9cc427e8095e453327c56bca4b1c7fa36d20
parent9fc05aae02015011052ad0da2bd602951b12c071
- Further refined 0.5.1's warning about delete-orphan cascade
placed on a many-to-many relation.   First, the bad news:
the warning will apply to both many-to-many as well as
many-to-one relations.  This is necessary since in both
cases, SQLA does not scan the full set of potential parents
when determining "orphan" status - for a persistent object
it only detects an in-python de-association event to establish
the object as an "orphan".  Next, the good news: to support
one-to-one via a foreign key or assocation table, or to
support one-to-many via an association table, a new flag
single_parent=True may be set which indicates objects
linked to the relation are only meant to have a single parent.
The relation will raise an error if multiple parent-association
events occur within Python.

- Fixed bug in delete-orphan cascade whereby two one-to-one
relations from two different parent classes to the same target
class would prematurely expunge the instance.  This is
an extension of the non-ticketed fix in r4247.

- the order of "sethasparent" flagging in relation to
AttributeExtensions has been refined such that false setparents
are issued before the event, true setparents issued afterwards.
event handlers "know" that a remove event originates
from a non-orphan but need to know if its become an orphan,
and that append events will become non-orphans but need to know
if the event originates from a non-orphan.
CHANGES
doc/build/mappers.rst
doc/build/session.rst
lib/sqlalchemy/orm/__init__.py
lib/sqlalchemy/orm/attributes.py
lib/sqlalchemy/orm/properties.py
lib/sqlalchemy/orm/strategies.py
lib/sqlalchemy/orm/unitofwork.py
test/orm/cascade.py
test/orm/relationships.py