Hi Simon!
I think it doesn't work. But I might be using a old version of the
sqlobjects (the one provided by ubuntu 9.04).
Example:
######################################################
import sqlobject
class A (sqlobject.SQLObject):
name = sqlobject.StringCol (unique=True)
class B (sqlobject.SQLObject):
name = sqlobject.StringCol (unique=True)
a = sqlobject.RelatedJoin ('A')
if __name__ == "__main__":
#from optparse import OptionParser, OptionGroup
# Use the same DB connection for all the thread.
sqlobject.sqlhub.threadConnection = sqlobject.connectionForURI
('sqlite:///tmp/test.db')
A.createTable()
B.createTable ()
######################################################
after running the example this is the schema on the database:
CREATE TABLE a (
id INTEGER PRIMARY KEY,
name TEXT UNIQUE
);
CREATE TABLE b (
id INTEGER PRIMARY KEY,
name TEXT UNIQUE
);
Not quite what I would expect (I'm missing the table "b_a").
Is it now clear?
I'm going to try with a newer version. This tests were run with version 0.10.2.
Best regards,
Miguel Tavares
2009/8/12 Simon Cross <[email protected]>:
> On Wed, Aug 12, 2009 at 12:25 PM, Miguel Tavares<[email protected]> wrote:
>> I think I didn't explain myself well. The example I provided has two
>> relationships. A->B, B->A, both different - so they can't (or
>> shouldn't) use the same table.
>
> You're looking for the intermediateTable option to RelatedJoin. See [1].
>
> [1]
> http://www.sqlobject.org/SQLObject.html#relatedjoin-and-sqlrelatedjoin-many-to-many
>
> Schiavo
> Simon
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> sqlobject-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
>
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss