django/django — pull request #1521 by maraujop (2013-08-28 09:54:55+00:00)
Title: Fix in MySQL converters for one item sequences

MySQLdb1 currently has a bug that produces incorrect SQL when dealing with one item sequences, closed as wontfix. This bug is reported in https://github.com/farcepest/MySQLdb1/issues/10

What this means, is that in Django when executing the following query with latest MySQLdb driver:

```
cursor.execute("SELECT * FROM table WHERE id IN %(ids_param)s", (1,))
```

Produces the following SQL (watch the trailing comma):

```
SELECT * FROM table WHERE id IN (1,)
```

Which obviously is not valid SQL and fails.

This patch adds a converter function to the MySQL backend that deals with one item sequences correctly. As the author is not fixing this behavior, I considered correctly add this workaround to Django, hopefully find more comprehension.

I haven't added acceptance tests for this behavior, if necessary, please point me for the right location to add them.

Thanks, cheers,
Miguel