diff --git a/djangotoolbox/db/base.py b/djangotoolbox/db/base.py index 299222f..afd6498 100644 --- a/djangotoolbox/db/base.py +++ b/djangotoolbox/db/base.py @@ -91,5 +91,23 @@ def __setattr__(self, name, value): raise NotImplementedError('Cursors not supported') class NonrelDatabaseWrapper(BaseDatabaseWrapper): + # These fake operators are required for SQLQuery.as_sql() support. + operators = { + 'exact': '= %s', + 'iexact': '= UPPER(%s)', + 'contains': 'LIKE %s', + 'icontains': 'LIKE UPPER(%s)', + 'regex': '~ %s', + 'iregex': '~* %s', + 'gt': '> %s', + 'gte': '>= %s', + 'lt': '< %s', + 'lte': '<= %s', + 'startswith': 'LIKE %s', + 'endswith': 'LIKE %s', + 'istartswith': 'LIKE UPPER(%s)', + 'iendswith': 'LIKE UPPER(%s)', + } + def _cursor(self): return FakeCursor()