Re: Passing parameters to raw()

2013-05-24 Thread VernonCole
Understand that this will not affect django for the next several releases. Probably django 2.0. The transition from db-api 2 to db-api 3 will be a lot like the transition from Python 2 to Python 3. You will have to import a different module to get the different behavior, and today's api-2 in

Re: Passing parameters to raw()

2013-05-24 Thread Roman Klesel
Oh wow! I didn't expect to enter such difficult terrain ... ;-) >From PEP-249 I understand that pyformat is encouraged and supported. I also read throug the discussion on the sig-db mailing list. As far as I understand you (Veron and many others) are trying to settle on what will be in the spec

Re: Passing parameters to raw()

2013-05-23 Thread Russell Keith-Magee
On Thu, May 23, 2013 at 2:19 PM, VernonCole wrote: > > Officially (according to PEP-249) you are not supposed to be able to do > that (pass a dictionary of parameters), but PostgreSQL does it as an > extension to the spec. > Are you sure about this? http://www.python.org/dev/peps/pep-0249/#par

Re: Passing parameters to raw()

2013-05-22 Thread VernonCole
Officially (according to PEP-249) you are not supposed to be able to do that (pass a dictionary of parameters), but PostgreSQL does it as an extension to the spec. SQLite and ms-sql (both of which use format converters to send your queries out with '?' where you put the '%s') do NOT support

Re: Passing parameters to raw()

2013-05-22 Thread Russell Keith-Magee
On Wed, May 22, 2013 at 5:37 PM, Roman Klesel wrote: > Hello, > > > the docs say: > > """ > Passing parameters into raw() > > If you need to perform parameterized queries, you can use the params > argument to raw(): > > >>> lname = 'Doe' > >>> Person.objects.raw('SELECT * FROM myapp_person WHERE l

Re: Passing parameters to raw()

2013-05-22 Thread Shai Berger
Hi Roman, On Wednesday 22 May 2013, Roman Klesel wrote: > > howerver this woks just fine and I see no reason why this should not be done: > >>> param = dict(lname = 'Doe') > >>> qs = Person.objects \ > >>>.raw('SELECT * FROM myapp_person WHERE last_name = %(lname)s', param) > This currently

Passing parameters to raw()

2013-05-22 Thread Roman Klesel
Hello, the docs say: """ Passing parameters into raw() If you need to perform parameterized queries, you can use the params argument to raw(): >>> lname = 'Doe' >>> Person.objects.raw('SELECT * FROM myapp_person WHERE last_name = %s', >>> [lname]) params is a list of parameters. You’ll use %