I apologize, that was a typo. In my script I am actually printing the same variable that I am incrementing. My example should read:
print "Count: " + str(count) The problem is that the printed count is not the actual number of records returned if printed query is run using another MySQL client. I am using the same user account from the same host in python script and with the MySQL command line client. On Dec 24, 4:54 pm, Michael Trier <[email protected]> wrote: > Record_count is never set. > > Michael > > On Dec 23, 2008, at 3:27 PM, Philip <[email protected]> wrote: > > > > > I am having a problem that I am not able to figure out. Maybe someone > > else can see what I am doing wrong. I am building a query using the > > SQL expression language. Then printing the SQL statement and counting > > the resulting records. When I run the generated SQL statement in the > > command-line MySQL client it yields 100's of results. The problem is > > that the count that the script prints out is 0. I have included the > > code below: > > > sel = select([table]) > > sel = sel.select_from(table.join(listing, table.c.col_sysid == > > listing.c.sysid)) > > sel = sel.where(table.c.last_tr_date != listing.c.modified_date) > > > print "SQL: " + sel > > > result = conn.execute(sel) > > > count = 0 > > for row in result: > > count = count + 1 > > > print "Count: " + str(record_count) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---
