Indeed I have to use the query/cursor mode. The query is a way more complex than that and I need some ordering based on calculated fields (which is not supported at the moment from the QuerySet api). I simplified the query simply to isolate the problem. some_id is indeed a foreign key to another table.
Any other suggestion? Thanks again Francesco On May 14, 3:28 pm, Martin Winkler <[EMAIL PROTECTED]> wrote: > Hi Francesco, > > Am Mon, 14 May 2007 12:44:46 -0000 > schrieb cesco <[EMAIL PROTECTED]>: > > > query = """SELECT id FROM my_table \ > > WHERE my_table.some_id IN %s""" > > cursor.execute(query, [(1, 2, 3)]) > > why are you diving so deep? > can't you just use > > myobjects = MyTable.objects.filter(some__in=(1,2,3)) ? > > (I am assuming that your model is called MyTable and that the field > "some_id" is in fact a ForeignKey field called "some") > > If you absolutely _have_to_ use the query/cursor code, then sorry, I > personally don't have a solution for that. > > Martin --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---