From: Edmund L. <el...@in...> - 2002-09-17 01:53:10
|
I'm stumped... could somebody please help me? I have a query that uses the in operator: matchDict = {'my_arg': [1, 2, 3]} sql = "select * from my_table where col_name in (%(my_arg)s)" c = cursor.execute(sql, matchDict) What should I do to 'my_arg' in matchDict so that it is correctly substituted into the SQL statement by pypgsql? I.e., I need the substitution to yield: select * from my_table where col_name in (1, 2, 3); How does the answer change if my_arg is a list of strings ['apple', 'orange', 'pear'], and the 'in' operator is applied to a varchar column? I.e., the substitution should yield: select * from my_table where col_name in ('apple', 'orange', 'pear'); ...Edmund. |