mirror of
https://github.com/sqlalchemy/sqlalchemy.git
synced 2026-06-07 00:01:12 -04:00
7c56371f81
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.