-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SQLBot draft #1448
SQLBot draft #1448
Conversation
Using SQL connection in a bot can be now more generic. PostgreSQL connection, execution and exception handling code was duplicated. Now, I've pulled it to the PostgreSQLBot that can be inherited instead and that inherits SQLBot. Like that, we may easily adopt for example SQLite engine.
Codecov Report
@@ Coverage Diff @@
## develop #1448 +/- ##
===========================================
- Coverage 75.53% 75.51% -0.02%
===========================================
Files 335 337 +2
Lines 16283 16293 +10
Branches 2230 2229 -1
===========================================
+ Hits 12299 12304 +5
- Misses 3489 3495 +6
+ Partials 495 494 -1
|
this commit should be squashed later, this is just a draft
Cool work, definitely appreciated :) |
Thanks, I'll do some changes and let you know :) |
@@ -1005,6 +1006,9 @@ | |||
"PostgreSQL": { | |||
"description": "PostgreSQL is the bot responsible to send events to a PostgreSQL Database. When activating autocommit, transactions are not used: http://initd.org/psycopg/docs/connection.html#connection.autocommit", | |||
"module": "intelmq.bots.outputs.postgresql.output", | |||
"help": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if we really want to have the help for parameters in that file. (#757 proposes some major steps in how parameters are handled including types and docs/help.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, sorry, that's definitely not part of this PR, I've just wondered how to implement help description to the Manager and been designing some ways... Then I discovered #757 and other and saw that nothing is decided yet and gave up :D
OUTDATED: Using SQL connection in a bot can be now more generic. PostgreSQL connection, execution and exception handling code was duplicated. Now, I've pulled it to the PostgreSQLBot that can be inherited instead and that inherits SQLBot.
Like that, we may easily adopt for example SQLite engine which is heavily used in CSIRTMalta workflow.
Could you take look at it please and tell me what design fails you see or that it's alright and I may develop further and do some SQLite bots?
UPDATE: This PR is a draft (just take a look at the code, tests fails due to not be edited yet).
lib/bot.py
that handles connection to relational databases – PostgreSQL and SQLite (heavily used in CSIRTMalta workflow). Now, I had two options. Either make a separate expert and output for every relational database (so that user can add "PostgreSQLOutput", "PostgreSQLLookupExpert", "SQLiteOutput", "SQLiteLookupExpert") or make a generic expert and generic output. I've chosen the latter.What do you think? That way, we may easily adopt any DB our users need.