Excerpts from Chris Withers's message of Thu Apr 15 11:46:05 -0300 2010:
> Michael Bayer wrote:
> > you have to rewrite your SQL to support the number of values in the IN
> > clause for each parameter set.
>
> Hmm :'(
>
> While my code knows the number of values, they don't, and it may vary
> from when they write the SQL to when that SQL gets executed by my code...
>
> Chris
>
My answer will be generic since I don't know id SA provide a better way
to deal with it (I haven't face this situation yet).
You will have to provide the values not as binded parameters but
hardcoded instead:
"""SELECT somestuff FROM somewhere
WHERE some_date >= :from_date AND some_date <= :to_date
AND somefield in (%s)""" % (",".join([str(x) for x in a]))
if you don't like this kind of hack, depending on your database, you can
create a temp table, insert all the values in it and join with your
real table.
--
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.