On Tue, May 15, 2007 at 05:56:01PM +0200, TiNo wrote:
> Ok, I figured out the join I need to do, and I declared the intermediate
> table like this:
> class Photo(SQLObject):
> [...]
> keywords = RelatedJoin("Keyword",otherColumn="keyword_id",
> joinColumn="photo_id",
> intermediateTable="keyword_photo")
> class Keyword(SQLObject):
> keyword = StringCol(alternateID=True)
> photos = RelatedJoin("Photo", joinColumn="keyword_id",
> otherColumn="photo_id",
>
> intermediateTable="keyword_photo")
>
> Is that correct? If so, how do I access the intermediateTable?
No, it is not enough. You have to make the intermediate table full
SQLObject table. Create and id column in it and declare it as
class KeywordPhoto(SQLObject):
photo = ForeignKey("Photo")
keyword = ForeignKey("Keyword")
Then use it in the SQLObject expressions.
Or construct low-level queries using sqlbuilder.Select().
> But asDict() does the trick. I should be mentioned in
> the docs
Many valuable things should be mentioned there. You can speed things up
by creating a documentation patch.
Oleg.
--
Oleg Broytmann http://phd.pp.ru/ [EMAIL PROTECTED]
Programmers don't die, they just GOSUB without RETURN.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss