Multiple LEFTJOINOn queries seem to work if all classes subclass SQLObject, but not if they subclass a subclass of InheritableSQLObject. This is what I mean:
################################################################ class zoo( SQLObject ): name = StringCol( ) cages = MultipleJoin( 'cage' ) class cage( SQLObject ): name = StringCol( ) animals = MultipleJoin( 'animal' ) zoo = ForeignKey( 'zoo' ) class animal( SQLObject ): name = StringCol( ) cage = ForeignKey( 'cage' ) ################################################################ So there are zoos, each zoo has a number of cages and each cage has a number of animals. The following query selects the total number of animals in a given zoo: ################################################################ 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( ) ################################################################ This is all fine, but if the model is changed slightly to use inheritance: ################################################################ class named( InheritableSQLObject ): name = StringCol( ) class zoo( named ): cages = MultipleJoin( 'cage' ) class cage( named ): animals = MultipleJoin( 'animal' ) zoo = ForeignKey( 'zoo' ) class animal( named ): cage = ForeignKey( 'cage' ) ################################################################ then the exact same query stops working. Why is that? If it is a feature and not a bug, what should be the correct query for the getting the total number of animals? Daniel python 2.5, SQLObject-0.10dev_r2660, sqlite. ------------------------------------------------------------------------- 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