Tefnet Developers wrote:
>
> SteveBallmer = Employee(name = 'Steve Ballmer')
> CraigMundie = Employee(name = 'Craig Mundie')
> BillGates = Employee(name = 'Bill Gates')
>
> CraigMundie.manager = BillGates
> SteveBallmer.subordinates = [CraigMundie]
>
> print "CraigMundie.manager: %s" % (CraigMundie.manager)
>
> # Why does CraigMundie appear here?
> # after SteveBallmer.subordinates = [CraigMundie]
> # CraigMundie.manager should be set to SteveBallmer so
> # CraigMundie should not be present in BillGates.subordinates
> print "BillGates.subordinates: %s" % (BillGates.subordinates)
> print "SteveBallmer.subordinates: %s" % (SteveBallmer.subordinates)
>
>
> Is this a SQLAlchemy bug or my mistake?

Backrefs deal with the two-way relation between A<->B, but the event does
not propagate in most cases to C or beyond, i.e. A<->B<->C where B is
attached to A would indicate C->B becomes detached in memory.  After a
commit() all those references would be expired and then you'd see the
actual connections.



--~--~---------~--~----~------------~-------~--~----~
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