Hello,
I think I am missing something very simple. The following command works fine
if there is no variable substitution:
cur2.execute("SELECT date,lat1,lon1 FROM table WHERE eventid = 1001;")

but when I try the following I get 'TypeError: unindexable object':

events = [1001,1002,1003]
for num in events:
cur2.execute("SELECT date,lat1,lon1 FROM table WHERE eventid = %s",(num,))

I have tried all manor of variation I can think of - (%s,)(num,) or '%s',
num or %(what)s,{what:(num,)} etc..

Any ideas on what I'm doing wrong?
Thanks,

Mike
-- 
View this message in context: 
http://www.nabble.com/execute-a-query-with-psycopg2-tp15343055p15343055.html
Sent from the Python - db-sig mailing list archive at Nabble.com.

_______________________________________________
DB-SIG maillist  -  DB-SIG@python.org
http://mail.python.org/mailman/listinfo/db-sig

Reply via email to