davispuh/MySQL-for-Python-3

This package does not works with Django

Closed this issue · 1 comments

If you change this function to it, then a Django projects will work:

def execute(self, query, args=None):

    ...

    if args is not None:
       query = query % db.literal(args)

    if isinstance(query, str):
        query = query.encode(charset);

    ...

You could see an example here:

https://travis-ci.org/goinnn/django-like/builds/15725382#L2000

I've never used Django.

This lib uses Python's 3 new str..format(...) and not %, it's so because I ported this to py3 very early and then there wasn't % in py3, it was added back only later. Also I personally like .format better than % and this lib was never meant to be backwards compatible, it's py3 only. Thus this is not a bug.

If you need such functionality, then you can use some forks which does implenet it, like manuelm/MySQL-for-Python-3