From: Deron M. <der...@gm...> - 2009-08-18 15:28:12
|
On Tue, Aug 18, 2009 at 11:19 AM, Nick Edds<ne...@gm...> wrote: > But what if later you want to run the query with items = ['A', 'B', 'C', > 'D']? > > Then you're going to need to construct a new query because the original > query can only support 3 items., so you lose the performance gain of making > a query that takes parameters. I can't really see a better solution though. Constructing the query and args dict using the list comprehension methods I showed will equally work for any sized list of items (>=1) without changing any python code. As far as I'm aware the substitution mechanism in the DBI is not there for performance; but is primarily there to make it easier to use, to facilitate automatic type conversions, and to help prevent mistakes in escaping and quoting SQL literals. I suspect any performance loss or gain will be negligible. -- Deron Meranda |