Someone already made some code for this, and it should be sitting in sqlobject-contrib, and here is the URL that started it:

http://xentac.net/~jchu/blog/technology/sqlobject-extra-relatedjoins.html

Though maybe one day it will end up in a more mature state in sqlobject core :).

-Igor

On 1/3/06, Leonardo Santagada <santagada@gmail.com> wrote:
I need to make a table that is a MultipleJoin with a field. The main idea is
that a course(in this case each ) is offered to a number of diferent facultieses
with a vacant number that differs for each faculty. Maybe the code will be
easier to understand:

from sqlobject import *

connection = connectionForURI('sqlite:///dbs.db')
sqlhub.processConnection = connection

class Faculdade(SQLObject):
    numero = StringCol(alternateID=True, length=10)
    nome = StringCol(length=50)
    cadeiras = RelatedJoin('Cadeira')
    Turmas = RelatedJoin('Turma', intermediateTable='Faculdade_turma_vagas')

class Cadeira(SQLObject):
    codigo = StringCol(alternateID=True, length=10)
    nome = StringCol(length=50)
    cargahoraria = IntCol()
    Faculdades = RelatedJoin('Faculdade')
    turmas = MultipleJoin('Turma')

class Turma(SQLObject):
    letra = StringCol(length=2)
    cadeira = ForeignKey('Cadeira')
    Faculdades = RelatedJoin('Faculdade', intermediateTable='Faculdade_turma_vagas')
    horarios = StringCol(length=200)
    professor = StringCol(length=200)

class Faculdade_turma_vagas(SQLObject):
    vagas = IntCol()

The thing is that this code doesn't work, because I already have a
Faculdade_turma_vagas table when sqlobject goes to create the last table. And I
am thinking that there must be a more pythonic and clean way of doing it. Can
someone please help?



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss