Hi,

I'd like to create a query at run time with any amount of filters
wrapped in an 'OR'.
What's the right syntax to do this?
This was my best attempt so far:

from sqlalchemy import *
id=[1,2]
q=Province.query.filter(or_(map(lambda n: Province.id == n, id)))

>>> q=Province.query.filter(or_(map(lambda n: Province.id == n, id)))
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "<string>", line 1, in <lambda>
  File "/home/kvdb/public/6pp/env/sevenpp_tg1.1_r6583/lib/python2.6/
site-packages/SQLAlchemy-0.5.5-py2.6.egg/sqlalchemy/orm/query.py",
line 52, in generate
    fn(self, *args[1:], **kw)
  File "/home/kvdb/public/6pp/env/sevenpp_tg1.1_r6583/lib/python2.6/
site-packages/SQLAlchemy-0.5.5-py2.6.egg/sqlalchemy/orm/query.py",
line 655, in filter
    raise sa_exc.ArgumentError("filter() argument must be of type
sqlalchemy.sql.ClauseElement or string")
ArgumentError: filter() argument must be of type
sqlalchemy.sql.ClauseElement or string

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