SQLDatabase
SQLDatabase prepares the connection to a database for other components to use, for example SQL Query Database Tool, with which an agent queries the database, or Natural Language to SQL, which turns a question into a SQL query. On its own it does not read or write data.
When to use it
- You want an agent to answer questions by querying your database.
- You want to turn questions into SQL queries over your database.
Configuration
The connection details are typed in the node itself.
| Field | What it does |
|---|---|
| User (required) | The database user. |
| Password (required) | Its password. |
| Hostname (required) | The server address. |
| Port | The server port. |
| Database | The database name. |
| Table To Use | Optional: the table to work with, if you know it. |
Output
The SQLDatabase output is the connection, to plug into components that ask for a database. URI Database string is the connection address as text.
Example
A sales director wants to ask an agent “how much did we sell in September?”.
- Add SQLDatabase with the sales database details.
- Connect the SQLDatabase output to a SQL Query Database Tool.
- Connect the tool to an agent and ask the question in the chat.
Good practices
- Use a database user with read-only permissions.
Related components
- Postgres SQL: reads and changes PostgreSQL rows directly.