summaryrefslogtreecommitdiff
path: root/searx/engines/postgresql.py
diff options
context:
space:
mode:
Diffstat (limited to 'searx/engines/postgresql.py')
-rw-r--r--searx/engines/postgresql.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/searx/engines/postgresql.py b/searx/engines/postgresql.py
index 78af8783c..5b39f924d 100644
--- a/searx/engines/postgresql.py
+++ b/searx/engines/postgresql.py
@@ -21,6 +21,8 @@ Implementations
"""
+import typing as t
+
try:
import psycopg2 # type: ignore
except ImportError:
@@ -55,15 +57,17 @@ paging = True
_connection = None
-def init(engine_settings):
- global _connection # pylint: disable=global-statement
-
+def setup(engine_settings: dict[str, t.Any]) -> bool | None:
if 'query_str' not in engine_settings:
raise ValueError('query_str cannot be empty')
if not engine_settings['query_str'].lower().startswith('select '):
raise ValueError('only SELECT query is supported')
+
+def init(_):
+ global _connection # pylint: disable=global-statement
+
_connection = psycopg2.connect(
database=database,
user=username,