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
On 6/18/07, Bill Denney <[EMAIL PROTECTED]> wrote:
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
something like:
def results():
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
that.
Bill
-------------------------------------------------------------------------
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
--
"Government does not solve problems; it subsidizes them."
Ronald Reagan
-------------------------------------------------------------------------
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