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.py29
1 files changed, 25 insertions, 4 deletions
diff --git a/searx/engines/postgresql.py b/searx/engines/postgresql.py
index d7ff6a11b..c0277207c 100644
--- a/searx/engines/postgresql.py
+++ b/searx/engines/postgresql.py
@@ -1,12 +1,33 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
# lint: pylint
-"""PostgreSQL database (offline)
+"""PostgreSQL is a powerful and robust open source database. Before configuring
+the PostgreSQL engine, you must install the dependency ``psychopg2``.
+
+Example
+=======
+
+Below is an example configuration:
+
+.. code:: yaml
+
+ - name: my_database
+ engine: postgresql
+ database: my_database
+ username: searxng
+ password: password
+ query_str: 'SELECT * from my_table WHERE my_column = %(query)s'
+
+Implementations
+===============
"""
-# import error is ignored because the admin has to install mysql manually to use
-# the engine
-import psycopg2 # pyright: ignore # pylint: disable=import-error
+try:
+ import psycopg2 # type: ignore
+except ImportError:
+ # import error is ignored because the admin has to install postgresql
+ # manually to use the engine.
+ pass
engine_type = 'offline'
host = "127.0.0.1"