On Mon, Oct 08, 2007 at 08:48:09PM +0400, Oleg Broytmann wrote: > joins = [ ] > joins.append( LEFTJOINOn( None, cage, animal.q.cageID==cage.q.id ) ) > joins.append( LEFTJOINOn( None, zoo, cage.q.zooID==zoo.q.id ) ) > > print animal.select( zoo.q.name=='myzoo', join=joins ).count( ) > > generates the query > > SELECT COUNT(*) FROM named LEFT JOIN cage ON ((animal.cage_id) = (cage.id)) > LEFT JOIN zoo ON ((cage.zoo_id) = (zoo.id)) > WHERE (((named.name) = ('myzoo')) AND ((named.child_name) = ('animal'))) > > for which SQLite returns the error: > > sqlobject.dberrors.OperationalError: no such column: animal.cage_id
In case of inheritance a call to .select() can produce a list of rows from the different tables (an instances of the different descendant of the parent class). This is both the strong point of the inheritance and its limitation. Inheritance works in two stages. At the first stage it selects IDs from the parent table (hence "FROM named" in the query above); at the second stage it draws the real objects from different tables. Because of these two stages inheritance cannot be used with complex queries. Joins with tables that lay lower in the hierarchy certainly confuses inheritance. 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: 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