Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on autosuggest fields #3023

Open
hobbypunk90 opened this issue Mar 4, 2024 · 1 comment
Open

Error on autosuggest fields #3023

hobbypunk90 opened this issue Mar 4, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@hobbypunk90
Copy link

Tandoor Version

1.5.13

Setup

Others (please state below)

Reverse Proxy

No reverse proxy

Other

Home Assistant Plugin

Bug description

I run tandoor as a home assistant plugin with sqlite db, i don't know when its broken, but when i try to suggest a keywork or an ingredient i only got an error.
the

Relevant logs

Browser Console:
OperationalError at /api/keyword/
no such function: UNACCENT
Request Method:	GET
Request URL:	.../api/keyword/?query=c&page=1&page_size=25
Django Version:	4.2.7
Exception Type:	OperationalError
Exception Value:	
no such function: UNACCENT
Exception Location:	/opt/recipes/venv/lib/python3.10/site-packages/django/db/backends/sqlite3/base.py, line 328, in execute
Raised during:	cookbook.views.api.KeywordViewSet
Python Executable:	/opt/recipes/venv/bin/python
Python Version:	3.10.13
Python Path:	
['/opt/recipes',
 '/opt/recipes/venv/bin',
 '/usr/local/lib/python310.zip',
 '/usr/local/lib/python3.10',
 '/usr/local/lib/python3.10/lib-dynload',
 '/opt/recipes/venv/lib/python3.10/site-packages']


Debug Log:
Internal Server Error: /api/keyword/
Traceback (most recent call last):
  File "/opt/recipes/venv/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/opt/recipes/venv/lib/python3.10/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute
    return super().execute(query, params)
sqlite3.OperationalError: no such function: UNACCENT

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/recipes/venv/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/opt/recipes/venv/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/opt/recipes/venv/lib/python3.10/site-packages/django/views/decorators/csrf.py", line 56, in wrapper_view
    return view_func(*args, **kwargs)
  File "/opt/recipes/venv/lib/python3.10/site-packages/rest_framework/viewsets.py", line 125, in view
    return self.dispatch(request, *args, **kwargs)
  File "/opt/recipes/venv/lib/python3.10/site-packages/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
  File "/opt/recipes/venv/lib/python3.10/site-packages/rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/opt/recipes/venv/lib/python3.10/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
  File "/opt/recipes/venv/lib/python3.10/site-packages/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
  File "/opt/recipes/venv/lib/python3.10/site-packages/rest_framework/mixins.py", line 40, in list
    page = self.paginate_queryset(queryset)
  File "/opt/recipes/venv/lib/python3.10/site-packages/rest_framework/generics.py", line 171, in paginate_queryset
    return self.paginator.paginate_queryset(queryset, self.request, view=self)
  File "/opt/recipes/venv/lib/python3.10/site-packages/rest_framework/pagination.py", line 204, in paginate_queryset
    self.page = paginator.page(page_number)
  File "/opt/recipes/venv/lib/python3.10/site-packages/django/core/paginator.py", line 72, in page
    number = self.validate_number(number)
  File "/opt/recipes/venv/lib/python3.10/site-packages/django/core/paginator.py", line 53, in validate_number
    if number > self.num_pages:
  File "/opt/recipes/venv/lib/python3.10/site-packages/django/utils/functional.py", line 57, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/opt/recipes/venv/lib/python3.10/site-packages/django/core/paginator.py", line 99, in num_pages
    if self.count == 0 and not self.allow_empty_first_page:
  File "/opt/recipes/venv/lib/python3.10/site-packages/django/utils/functional.py", line 57, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/opt/recipes/venv/lib/python3.10/site-packages/django/core/paginator.py", line 93, in count
    return c()
  File "/opt/recipes/venv/lib/python3.10/site-packages/django/db/models/query.py", line 608, in count
    return self.query.get_count(using=self.db)
  File "/opt/recipes/venv/lib/python3.10/site-packages/django/db/models/sql/query.py", line 568, in get_count
    return obj.get_aggregation(using, {"__count": Count("*")})["__count"]
  File "/opt/recipes/venv/lib/python3.10/site-packages/django/db/models/sql/query.py", line 554, in get_aggregation
    result = compiler.execute_sql(SINGLE)
  File "/opt/recipes/venv/lib/python3.10/site-packages/django/db/models/sql/compiler.py", line 1562, in execute_sql
    cursor.execute(sql, params)
  File "/opt/recipes/venv/lib/python3.10/site-packages/django/db/backends/utils.py", line 102, in execute
    return super().execute(sql, params)
  File "/opt/recipes/venv/lib/python3.10/site-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(
  File "/opt/recipes/venv/lib/python3.10/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/opt/recipes/venv/lib/python3.10/site-packages/django/db/backends/utils.py", line 84, in _execute
    with self.db.wrap_database_errors:
  File "/opt/recipes/venv/lib/python3.10/site-packages/django/db/utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/opt/recipes/venv/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/opt/recipes/venv/lib/python3.10/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute
    return super().execute(query, params)
django.db.utils.OperationalError: no such function: UNACCENT
::ffff:192.168.25.246 - - [04/Mar/2024:18:39:08 +0100] "GET /api/keyword/?query=c&page=1&page_size=25 HTTP/1.1" 500 194470 ".../edit/recipe/internal/35/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36"
@vabene1111
Copy link
Collaborator

the problem is that its trying to use unaccent on sqlite, not sure why to be honest, there should be a check to prevent this from happening.

@vabene1111 vabene1111 added the bug Something isn't working label Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants