Daniel Nogradi, el 14 de junio a las 17:19 me escribiste: > > > Hi, can you please test the code below (if you have sqlite)? If you > > > use a different db, can you please change the connectionForURI to use > > > yours and test then? The correct output should be 5 of course. > > > > I can't, but I don't see the point. What do you expect me to see running > > the test? > > > Well, if you would have a different db than sqlite and for you the > test would pass it would mean that the problem is either with sqlite > or the python binding pysqlite, but not sqlobject.
I thought Oleg tested that. Anyways, I've attached two output from the test (one for postgresql, and one for mysql), both failed as expected. > > > If you don't use joins, how would you select the total number of > > > animals in a zoo in this example? Select (almost) everything and > > > filter through them in python? > > > > For counting: > > > > count = 0 > > for c in the_zoo.cages: > > count += len(c.animals) > > > That is of course okay, but it will issue lot of sql queries and the > advantage of using joins is that there will only be a single query. So I know they are suboptimal, as I said: > > > > I use inheritance a lot, but I don't usually do JOINs (I just do > > > > it the OO > > > > way since I don't have very large sets of data) and it works very > > > > well. > > For selecting: > > > > my_list = [a for a in animal.select() if predicate(a)] > > Same here. Yes this one was just dumb, at least if your predicate can be expressed as a simple WHERE statement, where you can do: my_list = list(animal.select(zoo=a_zoo)) =) > I'll try to narrow down where the problem is (a) sqlite (b) pysqlite > (c) sqlobject. If anyone else could give the test code a shot with a > different db that would be really helpful. I think it's an inheritance problem. The query is not well constructed. Even this simple query is not well constructed: animal.select( zoo.q.name=='myzoo').count() -> 1/QueryOne: SELECT COUNT(*) FROM named WHERE (((named.name) = ('myzoo')) AND ((named.child_name) = ('animal'))) I don't think inheritance was though for this kind of use (which I think it's making inheritance go wild is the common ansestor for al classes). -- LUCA - Leandro Lucarella - Usando Debian GNU/Linux Sid - GNU Generation ------------------------------------------------------------------------ E-Mail / JID: [EMAIL PROTECTED] GPG Fingerprint: D9E1 4545 0F4B 7928 E82C 375D 4B02 0FE0 B08B 4FB2 GPG Key: gpg --keyserver pks.lugmen.org.ar --recv-keys B08B4FB2 ------------------------------------------------------------------------ DETUVIERON BANDA DE PIRATAS DEL ASFALTO SON TODOS URUGUAYOS Y ROBARON MILES DE LITROS DE CERVEZA -- Crónica TV ------------------------------------------------------------------------- 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