I could use some insightful suggestions here:
What do you think of this use case?

Let's say I have a class Foo mapped to a table 'foos',  and a
many:many relation between these objects, stored in the table
'foo_relations'.

columns on foos:
id (Integer)
data (Text)

columns on foo_relations:
this_foo_id (Integer)
that_foo_id (Integer)

But this implicitly creates a "direction" to the m:m relation,
something that I don't want.  I want this m:m relation to be bi-
directional (or you could call it "adirectional").  The setup above
makes one foo into "this" and the other into "that".  It's not, of
course, because of what I labeled them; it's because the columns have
to be labeled at all.  But I don't want a specific directionality
here.

Now when I want to find out whether a Foo has a relation to another
Foo, I have to check whether there exists any row in foo_relations
that has the given Foo as either as "this" OR "that".  Also, what if I
need backrefs on the foo_relations mapper?  The backref from 'this'
and the backref from 'that' would both point to something called a
foo, but they would have to be given separate labels in order ot not
be conflicting property names -- when really, I would not want to know
if a foo was the 'that' or the 'this' of some foo relation.

So ideally in a case like this, I could set an option that says the
m:m relation is bidirectional, and that the backrefs for both foreign
keys in the m:m table should really point to the same place (or at
least be unioned together).

I have a feeling that would violate some part of the RDBMS standards,
and I'm perfectly willing to go without or work around.  This is more
of a philosophical point for learning's sake -- what do other people
do in such cases?

Thanks,
Eric

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