﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
15836	Raw query documentation indicates wrong type for params	riverfr0zen@…	nobody	"Pretty trivial, but the documentation (and example) indicate that the raw() method takes params as a list. However, this results in an error (see steps to reproduce below). Tuples, rather, have to be used.

See: http://docs.djangoproject.com/en/1.3/topics/db/sql/#passing-parameters-into-raw

To reproduce:

{{{
>>> from django.contrib.auth.models import User
>>> User.objects.raw(""SELECT * FROM auth_user WHERE id = %s AND username = '%s'"", [1, 'test'])
Traceback (most recent call last):
  File ""<console>"", line 1, in <module>
  File ""/home/irf/htdocs/ourgroup/trunk/lib/python2.6/site-packages/django/db/models/query.py"", line 1376, in __repr__
    return ""<RawQuerySet: %r>"" % (self.raw_query % self.params)
TypeError: not enough arguments for format string
>>> 
>>> 
>>> User.objects.raw(""SELECT * FROM auth_user WHERE id = %s AND username = '%s'"", (1, 'test'))
<RawQuerySet: ""SELECT * FROM auth_user WHERE id = 1 AND username = 'test'"">

}}}

Platform:
Ubuntu 10.10 \n \l
Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56) 
[GCC 4.4.5] on linux2
"	Bug	closed	Documentation	1.3	Normal	duplicate			Accepted	0	0	1	0	0	0
