-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
Description
When building on sqlite and accessing any encounter we get:
Exception Type: NotSupportedError at /api/v2/pokemon/2/encounters
Exception Value: DISTINCT ON fields is not supported by this database backend
Possible due to:
Line 992 in c2a1bb8
| .distinct("location_area") |
Full stacktrace below.
Traceback (most recent call last):
File "C:\Users\aless\Documents\Github\pokeapi\venv2\Lib\site-packages\django\core\handlers\exception.py", line 47, in inner
response = get_response(request)
File "C:\Users\aless\Documents\Github\pokeapi\venv2\Lib\site-packages\django\core\handlers\base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\aless\Documents\Github\pokeapi\venv2\Lib\site-packages\django\views\decorators\csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "C:\Users\aless\Documents\Github\pokeapi\venv2\Lib\site-packages\django\views\generic\base.py", line 70, in view
return self.dispatch(request, *args, **kwargs)
File "C:\Users\aless\Documents\Github\pokeapi\venv2\Lib\site-packages\rest_framework\views.py", line 509, in dispatch
response = self.handle_exception(exc)
File "C:\Users\aless\Documents\Github\pokeapi\venv2\Lib\site-packages\rest_framework\views.py", line 469, in handle_exception
self.raise_uncaught_exception(exc)
File "C:\Users\aless\Documents\Github\pokeapi\venv2\Lib\site-packages\rest_framework\views.py", line 480, in raise_uncaught_exception
raise exc
File "C:\Users\aless\Documents\Github\pokeapi\venv2\Lib\site-packages\rest_framework\views.py", line 506, in dispatch
response = handler(request, *args, **kwargs)
File "C:\Users\aless\Documents\Github\pokeapi\pokemon_v2\api.py", line 1001, in get
for area_id in area_ids:
File "C:\Users\aless\Documents\Github\pokeapi\venv2\Lib\site-packages\django\db\models\query.py", line 280, in __iter__
self._fetch_all()
File "C:\Users\aless\Documents\Github\pokeapi\venv2\Lib\site-packages\django\db\models\query.py", line 1324, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "C:\Users\aless\Documents\Github\pokeapi\venv2\Lib\site-packages\django\db\models\query.py", line 171, in __iter__
for row in compiler.results_iter(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size):
File "C:\Users\aless\Documents\Github\pokeapi\venv2\Lib\site-packages\django\db\models\sql\compiler.py", line 1130, in results_iter
results = self.execute_sql(MULTI, chunked_fetch=chunked_fetch, chunk_size=chunk_size)
File "C:\Users\aless\Documents\Github\pokeapi\venv2\Lib\site-packages\cachalot\monkey_patch.py", line 29, in inner
return original(compiler, *args, **kwargs)
File "C:\Users\aless\Documents\Github\pokeapi\venv2\Lib\site-packages\cachalot\monkey_patch.py", line 83, in inner
cache_key = cachalot_settings.CACHALOT_QUERY_KEYGEN(compiler)
File "C:\Users\aless\Documents\Github\pokeapi\venv2\Lib\site-packages\cachalot\utils.py", line 82, in get_query_cache_key
sql, params = compiler.as_sql()
File "C:\Users\aless\Documents\Github\pokeapi\venv2\Lib\site-packages\django\db\models\sql\compiler.py", line 534, in as_sql
distinct_result, distinct_params = self.connection.ops.distinct_sql(
File "C:\Users\aless\Documents\Github\pokeapi\venv2\Lib\site-packages\django\db\backends\base\operations.py", line 179, in distinct_sql
raise NotSupportedError('DISTINCT ON fields is not supported by this database backend')
Exception Type: NotSupportedError at /api/v2/pokemon/2/encounters
Exception Value: DISTINCT ON fields is not supported by this database backend