Hi,
The keys of the following dictionary are column names while values are
lists of options for the column in question:

colvsopt={'column1':['option1','option2'],'column2':
['option3','option4l'],.....}

I need to write a query:
SELECT * FROM SOMETABLE WHERE (column1=option1 OR column1=option2) AND
(column2=option3 OR column2=option4) AND ...
in sqlalchemy. I tried almost everything but it did not work my best
try is:

query(tab).filter(and_(*(map(or_(*(map(lambda
cv:tab.columns[col]==cv,colvsopt[col]))))))for col in colvsopt.keys())

Here I get the error:
sqlalchemy.exc.ArgumentError: filter() argument must be of type
sqlalchemy.sql.ClauseElement or string

Could someone help me with this?
Thanks

-- 
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 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to