def last_executed_query(self, cursor, sql, params):
        from django.utils.encoding import smart_unicode, force_unicode

        # Convert params to contain Unicode values.
        to_unicode = lambda s: force_unicode(s, strings_only=True, errors='replace')
        if isinstance(params, (list, tuple)):
            u_params = tuple([to_unicode(val) for val in params])
        else:
            u_params = dict([(to_unicode(k), to_unicode(v)) for k, v in params.items()])

        return smart_unicode(sql) % u_params
Returns a string of the query last executed by the given cursor, with
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/django/db/backends/__init__.py/BaseDatabaseOperations.last_executed_query