On 6/18/07, Jaime Wyant <[EMAIL PROTECTED]> wrote: > I think the rows are truncated to prevent really large objects from printing > hard-to-read representations. > > But, I think you're code may be just a bit off... > > def results(): > row = AttendanceRecord.select () > for i in row: > print i > > When you call the .select() method, you get a resultset object back. Here's > a quick snippet from my interpreter: > > In [17]: Test.select() > Out[17]: <SelectResults at 10d17b0> > > What's a SelectResults object? Well, my poor-man's definition is - "it's an > iterator for pulling SQLObjects from the database". Of course that only > scratches the surface. You can see more here -> > http://www.sqlobject.org/class-sqlobject.sresults.SelectResults.html > > Anyway, according to your variable names in your results function, you're > actually iterating through a `row'. However, you're really iterating over a > SelectResults object. So, to lessen the confusion, you should write your > function like this: > > def results() > for row in AttendanceRecord.select(): > print row.sqlmeta.asDict() > > The asDict method returns the `row' as a dictionary. So you can see > `everything' without truncation. > > hth, > jw > >
Thanks. I read in the docs that select results are generators, so it should be possible to yield each record without having to store the whole thing in memory. The final application is not going to have a lot of data, but I'd like to learn how to iterate over the results generator-style vs list or dictionary style. I managed to get it displayed in full using an ugly query = AttendanceRecord._connection.queryAll("SELECT * FROM attendance_record") but that's too much like mysqldb :) Thanks for the example with sqlmeta, I haven't experimented with that yet. take care, -- Matt ------------------------------------------------------------------------- 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