I keep getting an exception deep within sqlalchemy whenever I try to
select a bit of aggregate data using the Session (I'm using SA
0.5.0rc2). For now, assume that my metadata/mappers are sensible,
because I can't get over the thought that I'm just doing something
simple wrong with the query, but if there's nothing obviously wrong
here, I'll post mappers, etc

Python 2.4.2 (#1, Apr 13 2007, 16:09:19)
[GCC 4.1.0 (SUSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from clusterbank.model import *
>>> from sqlalchemy import func
>>> Session.query(Project).all()[0]
<Project name='systems' id=1L>
>>> Session.query(Project).join(Project.allocations, 
>>> Allocation.charges).all()[0]
<Project name='earlytesting' id=485L>
>>> Session.query(Project, func.count(Charge)).join(Project.allocations, 
>>> Allocation.charges).group_by(Charge.id).all()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/gpfs/home/janderso/lib/python/SQLAlchemy-0.5.0rc2-py2.4.egg/
sqlalchemy/orm/query.py", line 1019, in first
    ret = list(self[0:1])
  File "/gpfs/home/janderso/lib/python/SQLAlchemy-0.5.0rc2-py2.4.egg/
sqlalchemy/orm/query.py", line 944, in __getitem__
    return list(res)
  File "/gpfs/home/janderso/lib/python/SQLAlchemy-0.5.0rc2-py2.4.egg/
sqlalchemy/orm/query.py", line 1078, in __iter__
    return self._execute_and_instances(context)
  File "/gpfs/home/janderso/lib/python/SQLAlchemy-0.5.0rc2-py2.4.egg/
sqlalchemy/orm/query.py", line 1081, in _execute_and_instances
    result = self.session.execute(querycontext.statement,
params=self._params, mapper=self._mapper_zero_or_none(),
_state=self._refresh_state)
  File "/gpfs/home/janderso/lib/python/SQLAlchemy-0.5.0rc2-py2.4.egg/
sqlalchemy/orm/session.py", line 749, in execute
    return self.__connection(engine, close_with_result=True).execute(
  File "/gpfs/home/janderso/lib/python/SQLAlchemy-0.5.0rc2-py2.4.egg/
sqlalchemy/engine/base.py", line 848, in execute
    return Connection.executors[c](self, object, multiparams, params)
  File "/gpfs/home/janderso/lib/python/SQLAlchemy-0.5.0rc2-py2.4.egg/
sqlalchemy/engine/base.py", line 899, in execute_clauseelement
    return self._execute_compiled(elem.compile(dialect=self.dialect,
column_keys=keys, inline=len(params) > 1), distilled_params=params)
  File "/gpfs/home/janderso/lib/python/SQLAlchemy-0.5.0rc2-py2.4.egg/
sqlalchemy/engine/base.py", line 908, in _execute_compiled
    context = self.__create_execution_context(compiled=compiled,
parameters=distilled_params)
  File "/gpfs/home/janderso/lib/python/SQLAlchemy-0.5.0rc2-py2.4.egg/
sqlalchemy/engine/base.py", line 952, in __create_execution_context
    return
self.engine.dialect.create_execution_context(connection=self,
**kwargs)
  File "/gpfs/home/janderso/lib/python/SQLAlchemy-0.5.0rc2-py2.4.egg/
sqlalchemy/databases/mysql.py", line 1532, in create_execution_context
    return MySQLExecutionContext(self, connection, **kwargs)
  File "/gpfs/home/janderso/lib/python/SQLAlchemy-0.5.0rc2-py2.4.egg/
sqlalchemy/engine/default.py", line 167, in __init__
    self.compiled_parameters = [compiled.construct_params(m) for m in
parameters]
  File "/home/janderso/lib/python/SQLAlchemy-0.5.0rc2-py2.4.egg/
sqlalchemy/sql/compiler.py", line 211, in construct_params
    pd[self.bind_names[bindparam]] = bindparam.value()
TypeError: __init__() takes exactly 3 arguments (1 given)
>>>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to