build the "OR" clause separately: list = [] list.append(users.c.user_id==id) list.append(users.c.user_name==name)
statement = user.select(or_(*list)) or statement.append_whereclause(or_(*list)) alternate method: critrerion = users.c.user_id==id criterion = criterion.or(users.c.user_name==name) crtierion = criterion.or(<crit>) ... statement = user.select(criterion) On Nov 8, 2006, at 3:33 AM, Dominik Neumann wrote: > > Hello list, > > i need to build a dynamic where-statement, linked by the > OR-operator. > In the docs there are only examples with AND. > > example (snippet from docs): > statement = user.select() > statement.append_whereclause(user.c.user_id == id) > statement.append_whereclause(user.c.user_name == name) > > is it possible to get here the OR instead of the AND-operator? > > Best Regards, > -dn > > > > --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---