[orm-devel] many2many extension

Diedrich Vorberg orm-devel@mailman.tux4web.de
Thu, 28 Nov 2002 00:33:43 +0100

Hi Ross,

>For ORM, this means modifying the many2many class to take another
>parameter (I've called it myKey) which is the SQL column name in the
>parent table that hold the key that is stored in the matrix table.
I have added two parameters to the many2many relationship: myKey and 
childKey. The two new parameters default to the parent and the child 
class' primary key respectively and should solve this problem.

I moved the function that created the actual SQL code into
datasource.py so it can be overwriten for different SQL backends.
This may be hardly likely but it also makes access to the column's
internals easyer, because I use a lot of private attributes and the 
datasource class has access to those using friend methods. 

>I'm playing with ORM a bit, to see how it might fit into our Postgresql/Zope
>setup. One thing I'm looking at is the many2many relationship. As written,
>it has a builtin assumption: that your 'matrixtable' (I usually
>call this a linking table) hold the primary keys of the two linked tables.
Uhh... say is linking table in a way 'official'? To be completely 
honest I learned SQL from bits and peaces I picked up on the web. I 
never read a book on it with anything like an academic appeal to it.
(Most titles I find are 90% things I already know and I was never up 
to spend 40 EUR on that 10%) So if 'link table' is used for that kind 
of thing I'll modify the identifyer.


           _..._                            Diedrich Vorberg
         .'     '.
        /  _   _  \                         http://www.tux4web.de
        | (o)_(o) |                         info@tux4web.de
         \(     ) /            .---.
         //'._.'\ \           /     \       Internet Dienstleistungen
        //   .   \ \          \.@-@./       und 'Consulting'.
       ||   .     \ \         /`\_/`\
       |\   :     / |        //  _  \\      Linux Rules!
       \ `) '   (`  /_      | \     )|_
     _)``".____,.'"` (_    /`\_`>  <_/ \
     )     )'--'(     (    \__/'---'\__/
      '---`      `---`