summaryrefslogtreecommitdiff
path: root/searx/engines/mysql_server.py
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2023-06-30 18:07:02 +0200
committerMarkus Heiser <markus.heiser@darmarIT.de>2023-07-01 22:45:19 +0200
commit5720844fcdc8601798e10544e2fd25ce4f2ad099 (patch)
treeaf611e4aef436253f4fda9504d06e05e2621114d /searx/engines/mysql_server.py
parent8e8d8dabe9b17c9db8db7432c6bc063d9ae980d1 (diff)
[doc] rearranges Settings & Engines docs for better readability
We have built up detailed documentation of the *settings* and the *engines* over the past few years. However, this documentation was still spread over various chapters and was difficult to navigate in its entirety. This patch rearranges the Settings & Engines documentation for better readability. To review new ordered docs:: make docs.clean docs.live Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/engines/mysql_server.py')
-rw-r--r--searx/engines/mysql_server.py33
1 files changed, 29 insertions, 4 deletions
diff --git a/searx/engines/mysql_server.py b/searx/engines/mysql_server.py
index 8d0a49565..82bb37f51 100644
--- a/searx/engines/mysql_server.py
+++ b/searx/engines/mysql_server.py
@@ -1,12 +1,37 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
# lint: pylint
-"""MySQL database (offline)
+"""MySQL is said to be the most popular open source database. Before enabling
+MySQL engine, you must install the package ``mysql-connector-python``.
+
+The authentication plugin is configurable by setting ``auth_plugin`` in the
+attributes. By default it is set to ``caching_sha2_password``.
+
+Example
+=======
+
+This is an example configuration for querying a MySQL server:
+
+.. code:: yaml
+
+ - name: my_database
+ engine: mysql_server
+ database: my_database
+ username: searxng
+ password: password
+ limit: 5
+ 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 mysql.connector # pyright: ignore # pylint: disable=import-error
+try:
+ import mysql.connector # type: ignore
+except ImportError:
+ # import error is ignored because the admin has to install mysql manually to use
+ # the engine
+ pass
engine_type = 'offline'
auth_plugin = 'caching_sha2_password'