I am using mysql and when I write it like (1) then I get int is not iterable on the first one, but the raw works, if I do it like (1,) the first one works, but the raw one gets again the comma at the end, tried several ways always one of both not working, for me it looks kinda there is some magic happening and with only 1 value the comma is not removed, but is removed with several values.

For now I just use 2 variables one for the raw queries and one for the other, not the best solution, but works for now.


Am 16.11.2013 16:01, schrieb Javier Guerra Giraldez:
On Sat, Nov 16, 2013 at 7:40 AM, Thorsten Sanders
<thorsten.sand...@gmx.net> wrote:
realms=[1]
data = AuctionData.objects.filter(itemid__exact=itemid,realm__in=realms)
data2 = AuctionData.objects.raw('SELECT * FROM auctiondata_auctiondata WHERE
itemid_id=%s AND realm_id in %s ',[itemid,realms])

not sure if it's related. but most SQL adaptors use a tuple for the
IN(...) parameters, not a list.

check http://initd.org/psycopg/docs/usage.html#tuples-adaptation


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5287E5FD.4090406%40gmx.net.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to