ivelum/djangoql

Search on Oracle Backend

Opened this issue · 1 comments

Has anyone used djangoql with Oracle. I keep getting this error when I attempt search on a secondary Oracle database/

django.db.utils.NotSupportedError: This backend does not support explaining query execution.
[20220126_16:53:27] ERROR [django.request:224] Internal Server Error: /admin/oracleApp/table/
Traceback (most recent call last):
File "/data/django/_env39/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/data/django/_env39/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/data/django/_env39/lib/python3.9/site-packages/django/contrib/admin/options.py", line 616, in wrapper
return self.admin_site.admin_view(view)(*args, **kwargs)
File "/data/django/_env39/lib/python3.9/site-packages/django/utils/decorators.py", line 130, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/data/django/_env39/lib/python3.9/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
File "/data/django/_env39/lib/python3.9/site-packages/django/contrib/admin/sites.py", line 232, in inner
return view(request, *args, **kwargs)
File "/data/django/_env39/lib/python3.9/site-packages/import_export/admin.py", line 440, in changelist_view
return super().changelist_view(request, extra_context)
File "/data/django/_env39/lib/python3.9/site-packages/django/utils/decorators.py", line 43, in _wrapper
return bound_method(*args, **kwargs)
File "/data/django/_env39/lib/python3.9/site-packages/django/utils/decorators.py", line 130, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/data/django/_env39/lib/python3.9/site-packages/django/contrib/admin/options.py", line 1697, in changelist_view
cl = self.get_changelist_instance(request)
File "/data/django/_env39/lib/python3.9/site-packages/django/contrib/admin/options.py", line 736, in get_changelist_instance
return ChangeList(
File "/data/django/_env39/lib/python3.9/site-packages/django/contrib/admin/views/main.py", line 99, in init
self.queryset = self.get_queryset(request)
File "/data/django/_env39/lib/python3.9/site-packages/django/contrib/admin/views/main.py", line 476, in get_queryset
qs, search_may_have_duplicates = self.model_admin.get_search_results(
File "/data/django/_env39/lib/python3.9/site-packages/djangoql/admin.py", line 90, in get_search_results
explain()
File "/data/django/_env39/lib/python3.9/site-packages/django/db/models/query.py", line 817, in explain
return self.query.explain(using=self.db, format=format, **options)
File "/data/django/_env39/lib/python3.9/site-packages/django/db/models/sql/query.py", line 560, in explain
return '\n'.join(compiler.explain_query())
File "/data/django/_env39/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1228, in explain_query
result = list(self.execute_sql())
File "/data/django/_env39/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1162, in execute_sql
sql, params = self.as_sql()
File "/data/django/_env39/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 612, in as_sql
result.insert(0, self.connection.ops.explain_query_prefix(
File "/data/django/_env39/lib/python3.9/site-packages/django/db/backends/base/operations.py", line 676, in explain_query_prefix
raise NotSupportedError('This backend does not support explaining query execution.')
django.db.utils.NotSupportedError: This backend does not support explaining query execution.

Hey @TylerRudie, thank you for reporting this. I'm not using Oracle personally; however, from the stack trace that you provided, it seems clear what the problem may be. Could you please try a version with the fix from the master branch?

pip3 install git+https://github.com/ivelum/djangoql.git@534b52938b65b63a8c4ff7b5d5355c5f2aa03781

If it works for you, I'll push a bugfix release to PyPI.