Skip to content

Commit 5f713cf

Browse files
committed
Update SQL documentation to mention all backends
The SQL mixin now handles SQLite, PostgreSQL, MSSQL, and MySQL/MariaDB. Make sure all of these are mentioned in the documentation for all SQL bots.
1 parent 2d55a9f commit 5f713cf

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

docs/user/bots.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2905,8 +2905,7 @@ Order of operation: `strip -> replace -> split`. These three methods can be comb
29052905

29062906
### Generic DB Lookup <div id="intelmq.bots.experts.generic_db_lookup.expert" />
29072907

2908-
This bot is capable for enriching intelmq events by lookups to a database. Currently only PostgreSQL and SQLite are
2909-
supported.
2908+
This bot is capable for enriching intelmq events by lookups to a database. Currently PostgreSQL, SQLite, MSSQL, and MySQL/MariaDB are supported.
29102909

29112910
If more than one result is returned, a ValueError is raised.
29122911

@@ -2918,7 +2917,7 @@ If more than one result is returned, a ValueError is raised.
29182917

29192918
**`engine`**
29202919

2921-
(required, string) Allowed values: `postgresql` or `sqlite`.
2920+
(required, string) Allowed values: `postgresql`, `sqlite`, `mssql`, or `mysql`.
29222921

29232922
**`database`**
29242923

@@ -2928,23 +2927,25 @@ If more than one result is returned, a ValueError is raised.
29282927

29292928
(optional, string) Name of the table. Defaults to `contacts`.
29302929

2931-
*PostgreSQL specific parameters*
2930+
*Database server (i.e. not SQLite) specific parameters*
29322931

29332932
**`host`**
29342933

2935-
(optional, string) Hostname of the PostgreSQL server. Defaults to `localhost`.
2934+
(optional, string) Hostname of the database server. Defaults to `localhost`.
29362935

29372936
**`port`**
29382937

2939-
(optional, integer) Port of the PostgreSQL server. Defaults to 5432.
2938+
(optional, integer) Port of the database server. Defaults to 5432 (which is the default for PostgreSQL).
29402939

29412940
**`user`**
29422941

2943-
(optional, string) Username for accessing PostgreSQL. Defaults to `intelmq`.
2942+
(optional, string) Username for accessing the database server. Defaults to `intelmq`.
29442943

29452944
**`password`**
29462945

2947-
(optional, string) Password for accessing PostgreSQL. Defaults to ?.
2946+
(optional, string) Password for accessing the database server. Defaults to ?.
2947+
2948+
*PostgreSQL specific parameters*
29482949

29492950
**`sslmode`**
29502951

@@ -5294,7 +5295,7 @@ Client certificates are not supported. If `http_verify_cert` is true, TLS certif
52945295

52955296
### SQL <div id="intelmq.bots.outputs.sql.output" />
52965297

5297-
SQL is the bot responsible to send events to a PostgreSQL, SQLite, or MSSQL Database.
5298+
SQL is the bot responsible to send events to a PostgreSQL, SQLite, MSSQL, or MySQL/MariaDB database.
52985299

52995300
!!! note
53005301
When activating autocommit, transactions are not used. See: <http://initd.org/psycopg/docs/connection.html#connection.autocommit>
@@ -5311,7 +5312,7 @@ The parameters marked with 'PostgreSQL' will be sent to libpq via psycopg2. Chec
53115312

53125313
**`engine`**
53135314

5314-
(required, string) Allowed values are `postgresql`, `sqlite`, or `mssql`.
5315+
(required, string) Allowed values are `postgresql`, `sqlite`, `mssql`, or `mysql`.
53155316

53165317
**`database`**
53175318

@@ -5343,7 +5344,7 @@ The parameters marked with 'PostgreSQL' will be sent to libpq via psycopg2. Chec
53435344

53445345
**`sslmode`**
53455346

5346-
(optional, string) Database sslmode, Allowed values: `disable`, `allow`, `prefer`, `require`, `verify-ca` or `verify-full`. See: <https://www.postgresql.org/docs/current/static/images/libpq-connect.html#libpq-connect-sslmode>. Defaults to `require`.
5347+
(optional, string, PostgreSQL only) Database sslmode, Allowed values: `disable`, `allow`, `prefer`, `require`, `verify-ca` or `verify-full`. See: <https://www.postgresql.org/docs/current/static/images/libpq-connect.html#libpq-connect-sslmode>. Defaults to `require`.
53475348

53485349
**`table`**
53495350

intelmq/bots/outputs/sql/output.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def g(obj):
2424

2525

2626
class SQLOutputBot(OutputBot, SQLMixin):
27-
"""Send events to a PostgreSQL or SQLite database"""
27+
"""Send events to an SQL database"""
2828
autocommit = True
2929
database = "intelmq-events"
3030
engine = None

intelmq/lib/mixins/sql.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class SQLMixin:
1616
You do not have to bother:
1717
* connecting database in the self.init() method, just call super().init(), self.cur will be set
1818
* catching exceptions, just call self.execute() instead of self.cur.execute()
19-
* self.format_char will be set to '%s' in PostgreSQL and to '?' in SQLite
19+
* self.format_char will be set to '?' in SQLite and '%s' otherwise
2020
"""
2121

2222
POSTGRESQL = "postgresql"

0 commit comments

Comments
 (0)