Thanks for your assistance, I got it working properly now.

On Jul 8, 9:55 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Tue, 2008-07-08 at 17:17 -0700, AJ wrote:
> > Thanks for your quick reply.  I have been searching for a long time
> > for good documentation on using IN and paramaters with no luck.  When
> > it worked with a list I assumed that was correct.  Could you clarify
> > an example of transforming a list of items into something mysqldb
> > would accept then executing it?  I think you are saying that if I have
> > 2 items in the list I need to manually specify:
>
> > zips = ['77777', '55544']
> > sql = """
> > SELECT id
> > FROM Event
> > WHERE zip_code IN %s, %s"""
> > cursor.execute(sql, (zips[0], zips[1]))
>
> That's not valid SQL. The "IN" operator requires something in
> parentheses. Normal SQL rules apply. Yes, it's possibly an error or an
> oversight that all this isn't handled automatically in some fashion, but
> it's really hard, since some databases allow array-like operations and
> there's all sort of edge-cases. I can't blame Python's DB-API for
> pushings things back to the client code here.
>
> Here's how Django constructs the SQL piece for "IN" 
> operators:http://code.djangoproject.com/browser/django/trunk/django/db/models/s...(that
>  line number is only valid until the next time that file is changed, but it's 
> the right file, so you can always just search for the word "IN").
>
> Regards,
> Malcolm
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to