[SQLObject] problem with querying a table
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Markus J. <mar...@ya...> - 2004-09-28 19:05:16
|
hi I have an Author table with firstName and Lastname columns. when I want to query the table like this: ----- res1 = Author.select(Author.q.firstName == "Alex") print res1 #print Author.select().count() print res1.count() -------- I get this error ./query.py <sqlobject.main.SelectResults object at 0x400b26ec> Traceback (most recent call last): File "./query.py", line 11, in ? print res1.count() File "/usr/local/lib/python2.3/site-packages/sqlobject/main.py", line 1239, in count count = self.accumulate('COUNT(*)') File "/usr/local/lib/python2.3/site-packages/sqlobject/main.py", line 1235, in accumulate return conn.accumulateSelect(self,expression) AttributeError: 'NoneType' object has no attribute 'accumulateSelect' but this is like the examples in the test directory. maybe I just oversaw something. what am I doing wrong ? I would just like to write something like this: if(res1.count() > 0): for author in res1: print author regards Markus |