Tarek Ziadé wrote:
Hello,
I am trying to bind a list for an in() operator in a pure SQL query :
import sqlalchemy
engine = create_engine('mysql://localhost/database')
connection = engine.connect()
connection.execute(engine.text(select * from user where email in
(:emails)), emails=['ta...@ziade.org'])
This will fail because the dialect will not bind a list for the
:emails params.
Is there a way to do this ? I looked at the expression compiler but
didn't find anything relevant.
Or do I have to build the query manually with a ','.join() in this case ?
you do. bind parameters don't expand into arrays with relational
databases.
Options to get around this include, putting a subquery into your in(), or
of course SQLA's in_() operator generates the bind parameters for you.
Regards,
Tarek
--
Tarek Ziadé | http://ziade.org
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to sqlalch...@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.
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to sqlalch...@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.