On Mar 27, 2011, at 6:33 PM, SAY wrote:

> I am running SQLAlchemy 0.6.6 and am getting the following exception:
> --------------------------------------------
>  File "/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.6.6-
> py2.6.egg/sqlalchemy/orm/query.py", line 1689, in __iter__
>    return self._execute_and_instances(context)
>  File "/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.6.6-
> py2.6.egg/sqlalchemy/orm/query.py", line 1694, in
> _execute_and_instances
>    mapper=self._mapper_zero_or_none())
>  File "/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.6.6-
> py2.6.egg/sqlalchemy/orm/session.py", line 720, in execute
>    clause, params or {})
>  File "/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.6.6-
> py2.6.egg/sqlalchemy/engine/base.py", line 1191, in execute
>    params)
>  File "/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.6.6-
> py2.6.egg/sqlalchemy/engine/base.py", line 1269, in
> _execute_clauseelement
>    parameters=params
>  File "/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.6.6-
> py2.6.egg/sqlalchemy/engine/base.py", line 1377, in
> __create_execution_context
>    connection=self, **kwargs)
>  File "/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.6.6-
> py2.6.egg/sqlalchemy/engine/default.py", line 388, in __init__
>    grp,m in enumerate(parameters)]
>  File "/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.6.6-
> py2.6.egg/sqlalchemy/sql/compiler.py", line 291, in construct_params
>    pd[self.bind_names[bindparam]] = bindparam.value()
> TypeError: __call__() takes exactly 3 arguments (1 given)
> --------------------------------------------
> It was calling a relatively simple query:
> --------------------------------------------
> query = session.query(model.ArtifactRevision)
> query = query.filter_by(id=2)
> revision = query.one()
> --------------------------------------------
> that generates the following SQL statement:
> --------------------------------------------
> SELECT ArtifactRevisions.id AS ArtifactRevisions_id,
> ArtifactRevisions.artifactID AS ArtifactRevisions_artifactID,
> ArtifactRevisions.revision AS ArtifactRevisions_revision,
> ArtifactRevisions.downloads AS ArtifactRevisions_downloads,
> ArtifactRevisions.favorites AS ArtifactRevisions_favorites,
> ArtifactRevisions.creationTime AS ArtifactRevisions_creationTime,
> ArtifactRevisions.publishTime AS ArtifactRevisions_publishTime  FROM
> ArtifactRevisions WHERE ArtifactRevisions.id = id_1;
> --------------------------------------------
> Has anyone seen this? Is this a user mistake? If so, what are the
> possible causes?
> 
> Please let me know if you need more information.

it means a callable object is being passed as the target of a comparison, such 
as:

        query.filter_by(id=some_callable_that_takes_three_arguments)

Or something similar to the above as caused by something more subtle, like a 
mis-configured relationship() or column_property() (if you are genuinely 
querying just one entity without any joins, then column_property() 
configuration could be at play here).

The behavior of callables being evaluated when passed as bind values has been 
removed in 0.7, and a separate bindparam() argument handles that particular use 
case, so that user-defined types which happen to expect an object type that 
also has a __call__() on it can function.   But if you aren't using any such 
user-defined types then you'd still have an error condition, just at a 
different point.



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

Reply via email to