Databases
Connect a database so that LOKI can answer questions about its data in the chat.
If you connect a database, LOKI can answer questions about its data in the chat, such as “How has revenue per region developed this year?”. LOKI turns this into a database query itself, evaluates the result and can create charts from it.
Only administrators manage databases. To set one up, you need the database's credentials; you get these from the person who looks after it.
Security
- LOKI only reads. LOKI does not run queries that would change data.
- Queries are limited: at most 1,000 rows per result and 30 seconds of running time.
- The password is protected. LOKI stores it encrypted and never shows it again.
- Only permitted groups can query a database in the chat.
Recommendation
Have a separate database user created for LOKI that may only read and only sees the tables LOKI is meant to use. That way the database stays protected even if a query turns out unusual.
Connecting a database
Open the form
Under Databases, click Create new.
Name and type
Enter a Name under which the database appears in the chat, for example “Sales DB”. Choose the Database type: PostgreSQL, MySQL, MariaDB, SQL Server or Oracle. If a type says driver not installed, LOKI cannot currently connect that type.
Connection details
Enter Host, Port (already filled in for the type), Database name, Username and Password. Under Options you can specify additional settings, such as an encrypted connection; you get the details for these from the person who looks after the database.
Test the connection
Click Test. The message tells you whether LOKI can reach the database:
| Message | What to check |
|---|---|
| Host unreachable | Address and port; can the database be reached from the appliance's network? |
| Authentication failed | Username and password |
| Database not found | Database name |
Schema (optional)
Under Schema you restrict LOKI to part of the database. Leave it empty to use the default area.
Description
The Description is required and important: LOKI reads it to decide when to query this database. Describe what data it contains and what questions it can answer, for example “Contains order history, customer records and inventory. Suitable for questions about sales figures or stock levels.” Generate description creates a suggestion from the database itself, which you can adjust.
Access
Under Access, tick the groups whose members may query the database in the chat. Without a group, nobody can use it.
Save
Click Create connection.
For special cases, the database type Custom (URI) offers a single field Connection URL, in which technical contacts enter a complete connection address.
In the chat
Members of the permitted groups see the database in the chat under Data sources in the Databases section. How they use it is described in Data sources and tools.
Editing and deleting
In the Database Connections list, the pencil opens the form for editing. The password and connection URL stay unchanged if you leave the fields empty. You delete a connection with the bin icon; it then disappears from the chat for all groups. The database itself is not affected.