<commit_before># Generic DB Lookup

This bot is capable for enriching intelmq events by lookups to a database.
Currently only postgres is supported.

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

## Parameters

### Connection

* `database`: string, defaults to "intelmq"
* `host`: string, defaults to "localhost"
* `password: string
* `port: integer, defaults to 5432
* `sslmode: string, defaults to "require"
* `table`: defaults to "contacts"
* `user`: defaults to "intelmq"

### Lookup

* `match_fields`: defaults to `{"source.asn": "asn"}`

The value is a key-value mapping an arbitrary number **intelmq** field names **to table** column names.
The values are compared with `=` only.

### Replace fields.

* `overwrite`: defaults to `false`. Is applied per field
* `replace_fields`: defaults to `{"contact": "source.abuse_contact"}`

`replace_fields` is again a key-value mapping an arbitrary number of **table** column names **to intelmq** field names <commit_msg>DOC: generic_db_lookup/README.md markup fix<commit_after># Generic DB Lookup

This bot is capable for enriching intelmq events by lookups to a database.
Currently only postgres is supported.

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

## Parameters

### Connection

* `database`: string, defaults to "intelmq"
* `host`: string, defaults to "localhost"
* `password`: string
* `port`: integer, defaults to 5432
* `sslmode`: string, defaults to "require"
* `table`: defaults to "contacts"
* `user`: defaults to "intelmq"

### Lookup

* `match_fields`: defaults to `{"source.asn": "asn"}`

The value is a key-value mapping an arbitrary number **intelmq** field names **to table** column names.
The values are compared with `=` only.

### Replace fields.

* `overwrite`: defaults to `false`. Is applied per field
* `replace_fields`: defaults to `{"contact": "source.abuse_contact"}`

`replace_fields` is again a key-value mapping an arbitrary number of **table** column names **to intelmq** field names 
{'fraction_non_alphanumeric': 0.12193903048475763, 'fraction_numerical': 0.00399800099950025, 'mean_word_length': 5.066666666666666, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '247160', 'n_tokens_mistral': 610, 'n_tokens_neox': 572, 'n_words': 253}