On Mon, Mar 23, 2015 at 2:45 PM, Edgaras Lukoševičius <edgaras.lukosevic...@gmail.com> wrote: > Hello, > > as I'm not receiving any responses in stackoverflow I wil try here. Can > someone help me with this issue? > > http://stackoverflow.com/questions/29195825/sqlalchemy-double-quoting-list-items >
For the benefit of the mailing list, this is what you are trying to do: sql_query = "SELECT col1, col2, col3 FROM preferences WHERE recipient IN :recipients" preferences = sqlsession.execute(sql_query,dict(recipient=tuple(message.recipients)) I don't think you can do this - bind parameters can only be used for single values. There's no way to pass multiple values (as required for the "IN" operator) in a single parameter. This isn't an sqlalchemy limitation (or even a Python one), eg. http://stackoverflow.com/questions/920353/can-i-bind-an-array-to-an-in-condition If you've told sqlalchemy about your preferences table, you can use its sql-building constructs, something like: q = sqlsession.query(Preferences).filter(Preferences.recipient.in_(message.recipients)) ...otherwise you probably need to build a list of bind parameters yourself. Hope that helps. Simon -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.