yota.n...@gmail.com wrote: > hello, > > I couldn't find how the dbapi2 planned to handle the sql IN statement. > > ex : > SELECT * FROM table WHERE num IN (2,3,8,9); > > I'd be glad to take advantage of the ? mechanism, but what about > tuples ! > > execute("""SELECT * FROM table WHERE num IN ?;""" , > ((2,3,8,9),)) ...fail... [...]
You cannot use parameter binding when the number of parameters is unknown in advance. So you'll have to create this part of the SQL query differently. For example: ids = [2, 3, 8, 9] in_clause = " (" + ",".join([str(id) for id in ids]) + ")" query = "select * from table where num in" + in_clause -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list