On Nov 21, 2012, at 7:05 AM, Ralph Heinkel wrote:
> Hi Michael,
>
> thanks for your reply.
>
>> but with that aside, you can use text():
>>
>> from sqlalchemy import text, bindparam
>> Person.status_id.in_(text("select status_id ...",
>> bindparams=[bindparam('n1', 'hired')]))
>>
>> and the bind values you can add later too:
>>
>> from sqlalchemy import text
>> Person.status_id.in_(text("select status_id ...")).params(n1='hired')
>>
>
> The latter was my favorite, but this seems to fail with
>
> [...]
> File
> "/usr/local/lib/python2.7/site-packages/SQLAlchemy-0.5.8-py2.7.egg/sqlalchemy/sql/expression.py",
> line 1390, in in_
> return self._in_impl(operators.in_op, operators.notin_op, other)
> File
> "/usr/local/lib/python2.7/site-packages/SQLAlchemy-0.5.8-py2.7.egg/sqlalchemy/sql/expression.py",
> line 1409, in _in_impl
> for o in seq_or_selectable:
> TypeError: '_TextClause' object is not iterable
>
> Any idea how to fix this?
yeah....its that "0.5.8" that's your problem on this one :). That version is
three years old. text() inside of in_() started working in the 0.6 series.
--
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.