From: Karsten H. <Kar...@gm...> - 2004-11-28 10:00:39
|
> > is there another way to provide arguements to a query besides tuples? eg. > > cur.excute("Select %s from table", (column)) > > becuase tuples cannot grow or shrink this is VERY limiting, i am in a > > situation right now where i need to select a range of days of week, > > because the length might change using a tuple is a pain. > > The second argument to execute() must be a sequence. You can use tuples, or > lists, for example. Be weary of one-element sequences, though. They tend to be troublesome. The trick we tend to use is if len(seq) == 1: seq.append(seq[0]) BTW, I am not sure you are intended to do "select %s from table", (column) The query arguments are intended to be values for the *where* clause, no ? Karsten -- GPG key ID E4071346 @ wwwkeys.pgp.net E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346 |