1.8 RawSQL Parameter Issue

33 views
Skip to first unread message

yong...@bloomsky.com

unread,
Aug 12, 2015, 9:47:53 PM8/12/15
to Django users
I'm using the new RawSQL class with annotate suggested by the django documentation. I noticed the second parameter the constructor takes is a tuple. When I used it in my project, however, I got a 'tuple object does not have attribute 'extend'' error. I looked at the trace back and source code, and found that django is calling 'extend()' on that parameter, which should not happen if the parameter is expected to be a tuple. I don't know if anyone has seen the same thing here. If I'm making a mistake, I'd like to know the correct use of RawSQL. Thanks a lot.

The example given in the django doc is:

qs.annotate(val=RawSQL("select col from sometable where othercol = %s", (someparam,)))
But this usage gives me an error stated above.

Tim Graham

unread,
Aug 12, 2015, 9:52:51 PM8/12/15
to Django users
Could you try adding a failing test case to Django's test suite based on your code in tests/expressions?
Reply all
Reply to author
Forward
0 new messages