That could be true for the 'parent' but I am not sure about the child
in a one-to-many relationship. Think of the scenario(also the example
in SQLObject).

A person object can have multiple address. The nice thing about
SQLObject is that I can defined a MultiJoin so when I access
person.addresses, it is a iterables. If I don't access
person.addresses, it may not issue the select statement, but if I do,
even just getting the id, the whole result set would be retrieved. I
don't think SQLObject would use a seperate SQL if I just want the IDs.

Lee McFadden wrote:
> I'm pretty sure that the SQL is only executed as needed.  The easiest
> way to test this would be to duplicate your model.py as a standalone
> and standard SQLObjects file, load it up in a python shell (probably
> using exec(file)) and then using Role._connection.debug = True. That
> will churn out every query that gets executed so you can see exactly
> what's going on.
>
> I tried doing this in the tg-admin shell to no avail.  I could set the
> object's _connection.debug but I never got any debug info from
> SQLObject.  Is there any reason why this is?
>
> "Role
> On 17/10/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> >
> > I think the question would be, is this "Role" instance a full
> > representation of the underlying tuple(row). If it does, it means the
> > data has been retrieved thus the performance concern. If it is lazily
> > evaluated(only retrieved when accessed), that would be the solution for
> > the initial question.
> >
> > gps wrote:
> > > "Two attributes will generally be created, role, which returns a Role
> > > instance, and roleID, which returns an integer ID for the related
> > > role." - SQLObject 0.7 documentation when talking about what ForeignKey
> > > does.
> >
> >

Reply via email to