I think turbogears is maintain the mapper config?... how do I get this information out..
Thanks mfk -----Original Message----- From: sqlalchemy@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of ml Sent: Wednesday, August 27, 2008 2:09 AM To: sqlalchemy@googlegroups.com Subject: [sqlalchemy] Re: error when running query.count() Hi! There are more than 1 mapper to an object. Send your mappers configuration. David mkhan napsal(a): > Hi, I am trying get a count for a query but it errors out with > following message: > > Page handler: <bound method Root.index of <harvest.controllers.Root > object at 0x018444B0>> > Traceback (most recent call last): > File "c:\python25\lib\site-packages\cherrypy-2.3.0-py2.5.egg\cherrypy > \_cphttptools.py", line 121, in _run > self.main() > File "c:\python25\lib\site-packages\cherrypy-2.3.0-py2.5.egg\cherrypy > \_cphttptools.py", line 264, in main > body = page_handler(*virtual_path, **self.params) > File "<string>", line 3, in index > File "c:\python25\lib\site-packages\TurboGears-1.0.5-py2.5.egg > \turbogears\controllers.py", line 359, in expose > *args, **kw) > File "<string>", line 5, in run_with_transaction > File "c:\python25\lib\site-packages\TurboGears-1.0.5-py2.5.egg > \turbogears\database.py", line 407, in sa_rwt > retval = func(*args, **kw) > File "<string>", line 5, in _expose > File "c:\python25\lib\site-packages\TurboGears-1.0.5-py2.5.egg > \turbogears\controllers.py", line 372, in <lambda> > mapping, fragment, args, kw))) > File "c:\python25\lib\site-packages\TurboGears-1.0.5-py2.5.egg > \turbogears\controllers.py", line 401, in _execute_func > output = errorhandling.try_call(func, *args, **kw) > File "c:\python25\lib\site-packages\TurboGears-1.0.5-py2.5.egg > \turbogears\errorhandling.py", line 77, in try_call > return func(self, *args, **kw) > File "C:\Documents and Settings\mkhan\workspace\TestAutomation > \Reports\Harvest\harvest\controllers.py", line 31, in index > print results2.count() > File "c:\python25\lib\site-packages\sqlalchemy-0.5.0beta3-py2.5.egg > \sqlalchemy\orm\query.py", line 1193, in count > return self._col_aggregate(sql.literal_column('1'), > sql.func.count, > nested_cols=list(self._only_mapper_zero().primary_key)) > File "c:\python25\lib\site-packages\sqlalchemy-0.5.0beta3-py2.5.egg > \sqlalchemy\orm\query.py", line 240, in _only_mapper_zero > raise sa_exc.InvalidRequestError("This operation requires a Query > against a single mapper.") > InvalidRequestError: This operation requires a Query against a single > mapper. > > I would appreciate some comments on what i am doing wrong, > > thanks, > > mfk > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---