> and here's some test code that passed the test:
>
> spam = ThingOne(name='spam')
> eggs = ThingOne(name='eggs')
> foo = ThingTwo(name='foo')
> bar = ThingTwo(name='bar')
> session.flush()
> Cat(one=spam, two=bar, sorter=1)
> Cat(one=spam, two=foo, sorter=2)
> session.flush()
> spam.refresh()
> bar.refresh()
> assert bar in spam.twos
> assert foo in spam.twos
> assert spam in bar.ones
> assert spam in foo.ones
> assert spam.twos[0] is bar
> assert spam.twos[1] is foo

Hmm.  If this makes the relationship between a ThingOne and a ThingTwo
work like a normal many-to-many relationship, I would have expected
you to be able to something like:

spam = ThingOne(name='spam')
foo = ThingTwo(name='foo')
bar = ThingTwo(name='bar')
spam.twos.append(foo)
spam.twos.append(bar)

and it would automatically maintain the 'Cat' table without having to
explicitly access it.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SQLElixir" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to