2007/5/15, Oleg Broytmann <[EMAIL PROTECTED]>:
> And if so, is there another way to do this?
Do it SQL-wise. Recreate and declare the intermediate table, and do a
join.
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? Because:
Photo.select(LEFTJOINOn(None,keyword_photo,Photo.id ==
keyword_photo.photo_id))
gives me:
Traceback (most recent call last):
File "<console>", line 1, in <module>
NameError: name 'keyword_photo' is not defined
??
Another question bubbles up. Is there a way to create a dict out of a
> SelectResult?
Starting with 0.8 SQLObject.sqlmeta has a method .asDict().
Or a JSONifiable object?
No, that's completely outside of the scope of SQLObject.
I understand. I meant a simple object that I could pass to a function that
converts it to JSON. But asDict() does the trick. I should be mentioned in
the docs I think. Quite a valueable method..
-------------------------------------------------------------------------
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
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss