[PEAK] QueryDM's with no query params

Erik Rose psucorp at grinchcentral.com
Fri May 20 16:17:20 EDT 2005


A common case in my app is ask for all the rows of a DB table—say, to 
get a full list of values for some popup menu. Correct me if I'm wrong, 
but it seems to make sense to use a QueryDM for this. The trouble is 
that QueryDM's seem to assume you'll need to parametrize their queries: 
for instance, QueryDM[someForeignKey]. In my case, I need no params: I 
simply want all the rows returned. I would expect something like this 
to work:

for each in myQueryDM:
     print each

However, it iterates forever, and I can't even figure out what it's 
finding to iterate over. (I can't find any __iter__() calls or 
anything.) Things break mysteriously when I try to use the debugger on 
them.

Passing it a dummy param works...

for each in myQueryDM[0]:
     print each

...but that's nasty. I'll kludge it for now, but what's the right way 
to do this?

Many thanks!
Erik



More information about the PEAK mailing list