hipster-philology / pyrrha

A language-independent post-correction app for POS-tagging and lemmatization
https://pyrrha.huma-num.fr
MIT License
27 stars 16 forks source link

SQL bug while fetching morph #160

Open MrGecko opened 4 years ago

MrGecko commented 4 years ago

Current Behaviour

Don't know much about how it happened since I just caught it in a log (from today) :

Traceback (most recent call last):
 File "pyrrha/venv/lib/python3.5/site-packages/sqlalchemy/engine/default.py", line 552, in do_execute
    cursor.execute(statement, parameters)
sqlite3.OperationalError: near ")": syntax error
...
  File " pyrrha/app/control_lists/views.py", line 211, in search_api
    ).limit(AUTOCOMPLETE_LIMIT)
...
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) near ")": syntax error
[SQL: SELECT allowed_morph.label AS allowed_morph_label, allowed_morph.readable AS allowed_morph_readable 
FROM allowed_morph 
WHERE allowed_morph.control_list = ? AND () GROUP BY allowed_morph.label
 LIMIT ? OFFSET ?]
[parameters: (3, 20, 0)]

It may be about the empty AND () in the query

Correct Behaviour

  1. No bugs.
  2. The issue relates potentially from an empty query parameters.
  3. No search should be perform if the value is empty.
PonteIneptique commented 4 years ago

Possible empty request on autocomplete ?