Hello Tim,

i guess, this is rather a catwalk problem than a sqlobject problem.

i guess you are using sqlobject within turbogears?

try adding your relations in the interactive shell. you can get one by executing

tg-admin shell

from within your project folder.

then you can try sth. like

Project.get(1).addContractor(Contractor.get(2))

i think that sqlobject does distinguish between two related joins
between the same two tables... i´m having kind of the same usecase and
it works quite well - catwalk is unfortunately not really
production-ready for some certain things - sometimes feels like a toy.

HTH,
Frank

2007/7/23, Tim Black <[EMAIL PROTECTED]>:
>
>  I posted this on the TurboGears list last week, and don't desire to
> cross-post.  But as it didn't receive a substantive answer, perhaps it is
> better to send it directly to the SQLObject list.  Thanks for your
> consideration.  - Tim
>
>  I'm trying to create more than one RelatedJoin between the same two
> classes.  I need to construct many-to-many relationships between Persons and
> Projects, because:
>
>  - one project can have multiple clients (when it's an open-source project)
>  - one project can have multiple contractors working on it
>  - one person can work as a contractor on multiple projects
>  - one person can be the client that pays for multiple projects
>  - one person can be a client on one project and a contractor on another
> project
>
>  Is it possible to do this in SQLObject?  How?
>
>  I've tried to represent this simply as:
>
>  class Person(SQLObject):
>      name = StringCol()
>      clientProjects = RelatedJoin("Project")
>      contractorProjects = RelatedJoin("Project")
>
>  class Project(SQLObject):
>      name = StringCol()
>      clients = RelatedJoin("Person")
>      contractors = RelatedJoin("Person")
>
>  But, when I add a client to a project in Catwalk, that client appears as a
> contractor as well on the same project!  Makes sense; for example, I
> shouldn't expect SQLObject to distinguish between two identical references
> to RelatedJoin("Project").  But how can I distinguish the two references
> properly?
>
>  I've tried various combinations of using joinColumn, otherColumn, and
> intermediateTable, but no success yet.  The documentation on joinColumn and
> otherColumn is not readily understandable; perhaps a UML diagram of the
> references between the classes and database tables could clarify the
> documentation.  The best luck I've had yet was to specify two
> intermediateTables - one for the project_client relation and one for the
> project_contractor relation.  But, that resulted in all persons being added
> as clients, even when I tried to add them as contractors.
>
>  Tim Black
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >>  http://get.splunk.com/
> _______________________________________________
> sqlobject-discuss mailing list
> sqlobject-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
>
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to