Daniel Nogradi, el 12 de junio a las 14:41 me escribiste:
> > > > > > > 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?

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

or:

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

For selecting:

my_list = [a for a in animal.select() if predicate(a)]

-- 
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
------------------------------------------------------------------------
Do not get mad with others
Because they know more than you
It is not their fault


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