> > > > > > > > sqlobject.dberrors.OperationalError: no such column:
> animal.cage_id
> > > > > > >
> > > > > > >    But there is "cage_id" columnm in the "animal" table
> > > > > >
> > > > > > Well, that's exactly the problem :)
> > > > >
> > > > >    Are you sure this part of the problem is in SQLObject and not in
> > > SQLite?
> > > > > (There are probably other problems - inheritance was developed for
> > > simple
> > > > > use cases and hardly support joins and aggregates...)
> > > >
> > > > I only guess that the problem is with SQLObject since SQLite itself is
> > > > pretty reliable. But I'm getting also more and more convinced that
> > > > using inheritance is not a good idea, I ran into other similar
> > > > troubles too. So probably it's best to stay away from them.
> > >
> > > 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.
> >
> >
> > 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.


> > 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
if performance is of concern using joins is advantageous but at the
moment I (or anyone else using sqlite) can't use them together with
inheritance.


>
> or:
>
>       count = 0
>       for a in animal.select():
>               if a.cage.zoo == the_zoo:
>                       count += 1


Here you potentially select a lot more items than necessary, so might
also be a problem performance-wise.


> For selecting:
>
> my_list = [a for a in animal.select() if predicate(a)]


Same here.


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.

Cheers,
Daniel

-------------------------------------------------------------------------
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

Reply via email to