> > I have a table that has two
> > parents,
> > that is a foreign key to two tables.  One of those tables isn't needed
> > by the application, but it needed for other applications that use
> > these
> > same SQLAlchemy models.
>
> > The following example shows first a default parent/child relationship
> > with the resulting query calls.  The second example shows an example
> > using passive_deletes=True in the relationship from child to parent,
> > which I understand doesn't make too much sense but causes my desired
> > behavior.  This, also, has the resulting query calls.
>
> > Is there a better way for me to get the behavior I desire, or is this
> > a
> > bug?
>
> Its a bug.   Many-to-ones are generally cheap since they're usually already 
> loaded, but in this case the load isn't needed and this is actually a recent 
> regression as of 0.6.6, so 0.6.5 won't exhibit this behavior...of course 
> 0.6.5 has the previous issue that was fixed here but its likely not as 
> common.  This is ticket #2049 and a fix will be available shortly.
>
> Also you might want to consider linking the "parent" and "children" 
> relationships via the "back_populates" attribute, or otherwise map them at 
> once using relationship + backref.  Otherwise the ORM treats mutations in 
> each attribute as separate which could lead to doubling of operations.  If 
> you're only mutating one side (or none) then it doesn't matter much.
>
>
>

Will this bug fix cause issues with models that have a relationship
with itself (where the parent of the object is another object of the
same class)?  I applied the patch you came up with and my tests fail
on this type of relationship.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to