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...
row = AttendanceRecord.select ()
for i in row:
When you call the .select() method, you get a resultset object back. Here's a quick snippet from my interpreter:
In : Test.select()
Out: <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:
for row in AttendanceRecord.select():
The asDict method returns the `row' as a dictionary. So you can see `everything' without truncation.
Matt Richardson wrote:
> Sorry for what is probably a painfully obvious question, but I can't
> figure out why this:
> def results():
> row = AttendanceRecord.select()
> for i in row:
> print i
> produces this:
> <AttendanceRecord 1L sid='831649232' timeIn='datetime.datetime...)'>
> <AttendanceRecord 2L sid='831649232' timeIn=' datetime.datetime...)'>
> Specifically, why is each row truncated? I've only been at sqlobject
> for a couple of days and I like it a lot more than mysqldb, but this
> is driving me a little nutty.
It just shows summary data. If you want to see everything, you can do
row = AttendanceRecord.select()
for i in row:
print "%d %s %s" % ( i.id, i.sid, i.timeIn)
There may be a way to make it print everything as well, but I don't know
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.
sqlobject-discuss mailing list