Hi,

just today I stumbled (again) above an implementation-artifact of 
MultipleJoin.

Consider the following situation:

class A(SQLObject):
    bs = MultipleJoin("B")

class B(SQLObject):
    an_a = ForeignKey("A")

What happens when trying to get 

instance_of_A.bs

is that SO does not know that the column-name to be used is

an_a_id

instead of 

a_id

and uses the latter. So one has to give the column-name explicit.

I'd like the idea of this becoming a bit more magic, and in case of ambiguity 
at least more in the Python-world than in the DB-world.

What do i mean? Well, if there is only one 1:n-relation A<-B, then I think we 
could safely assume that to be the one multiply joined, and thus query B for 
the column-name to use.

If there a several, ambiguity rises it's ugly head - then I'd suggest the 
following notation which abstracts from the id-column-stuff:

class A(...)
    bs = MultipleJoin("B", opposite="an_a")

The same considerations might apply to RelatedJoins, but I didn't think that 
through.

As always, I'd be implementing and testing things of course.

What do you think?

Diez

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to