Re: [SQLObject] MultipleJoin inactive in version 0.6
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Carlos R. <car...@gm...> - 2004-11-02 17:35:40
|
On Tue, 2 Nov 2004 15:16:01 +0000, Nigel King <nig...@or...> wrote: > > On 2 Nov 2004, at 14:29, Max Ischenko wrote: > > > You'd to use 'artist_id' instead. > > ah! this is beginning to make sense now > print Artist.get(2).tapeTitles[0].Title > now works properly and has some sense. Presumably titles is ONLY the > name of the column in the artist table, it seems to have no other > significance. It can't be used? It *has* significance. Try: a = Artist.get(2) print a.titles ...and it will return a list with all titles. Nice, don't you think? The 'artist' x 'artist_id' issue is simple: for every relationship, two fields are created, one referencing the 'id' field of the related table (artist_id, in this case); and the other one returning the entire entity being related to. The 'id' field is needed to make the relationship work. For your own use, you'll probably use the entity for most stuff. As for the need for the joinColumn parameter; in some cases, SQLObject can potentially figure out the correct name for the joinedColumn itself. In some cases, you have to supply it yourself, specially if you use names that are different from the original entity names, or if you have a more complex relationship graph. In your case, I think that SQLObject *could* have found the correct name itself, but then this may be a problem with the 0.6 release, for what I have understood from other answers. -- Carlos Ribeiro Consultoria em Projetos blog: http://rascunhosrotos.blogspot.com blog: http://pythonnotes.blogspot.com mail: car...@gm... mail: car...@ya... |