On Tue, Aug 01, 2006 at 07:47:48AM +0200, Didrik Pinte wrote:
> [1] vdata = validdata.select(AND(validdata.q.stationID == station.id,
> validdata.q.mtime == row.mtime))[0]
> 
> then I parse the states in this row with the following code :
> 
> [2] for state in states:
>       getattr(vdata, state)
> 
> My understanding is that vdata is a SelectResults and that the

   Wrong. You have used [0] to index the SelectResults object and hence get
an SQLObject instance.

> getatrr(vdata, state) will just fetch the data from this SelectResults.

   SelectResults doesn't hold any data itself - it is only a way to get a
list of SQLObject instances. You've got an SQLObject instance already, and
you fetches data from it.

> It seems that for each getattr(vdata, state) there is a new call to the
> database.

   Because you are fetching data via ForeignKey columns, and SQLObject
doesn't cache them (but it caches the referenced rows).

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            [EMAIL PROTECTED]
           Programmers don't die, they just GOSUB without RETURN.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to