Re: [DB-SIG] execute a query with psycopg2

2008-02-07 Thread Michael Castleton
Michael Castleton schrieb: > 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,)(n

Re: [DB-SIG] execute a query with psycopg2

2008-02-07 Thread Christoph Zwerschke
> In particular, you're not telling us which version of python you're > using, which database (and version) you're using, and which interface > module you're using. The interface and hence the db was mentioned in the subject, but it's a good practice (though not mentioned in smart-questions.html)

Re: [DB-SIG] execute a query with psycopg2

2008-02-07 Thread Mike Meyer
On Thu, 7 Feb 2008 12:51:56 -0800 (PST) Michael Castleton <[EMAIL PROTECTED]> wrote: > > 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

Re: [DB-SIG] execute a query with psycopg2

2008-02-07 Thread Christoph Zwerschke
Michael Castleton schrieb: > 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

[DB-SIG] execute a query with psycopg2

2008-02-07 Thread Michael Castleton
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 i