I'm using SA (with Elixir on top) and I have a parent Entity "Ranker"
that has many children "Results"; that is, for a Ranker instance rk,
rk.results gives its children and for a Result rs, rs.ranker gives its
parent. When I add new children by providing the parent to the
constructor of the child (rather than appending the child to
rk.results) and then try to flush, I get:

"FlushError: instance <Result at (...)> is an unsaved, pending
instance and is an orphan
(is not attached to any parent 'Ranker' instance via that classes'
'results' attribute)"

Here's a (very) stripped-down version of what I'm doing:

ranker = Ranker(...)
for score in scores:
    Result(ranker=ranker, score=score, **kwds).save()
session.flush()

I expected that I can create a parent-child link either from parent to
child (by appending to ranker.results) or from child to parent (as
above), but apparently the latter doesn't seem to work. Is this the
case or something else is wrong ?

George


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to