From: <gh...@gh...> - 2003-06-06 10:04:35
|
Steve Waterbury wrote: > Gerhard Häring wrote: >> executemany is not supposed to be used with SELECTs. Use it for INSERT >> or UPDATE only. > > Thanks ... I realized that right after I send my > question! :^) > >> [...] >> In your particular example: >> >> docnums = [3,4,5,6] >> curs.execute("select * from docs where doc_number in %s", (docnums,)) > > > That doesn't seem to work either: [...] Sorry, I meant to use a tuple instead of a list. So pyPgSQL will invoke repr() on the parameter before inserting it into the SQL. AFAIC this will currently work fine for ints and floats, but not much else. Also note that this is one thing that won't work in other adapters like for Oracle. But you can always construct your SQL with the appropriate IN-clause manually. -- Gerhard |