SQL Executor
SQL Executor connects to a database with its connection address and runs the SQL query you give it. It returns the result as text.
When to use it
- Running a query a model generated from a question.
- Running a one-off query without setting up a credential.
Configuration
| Field | What it does |
|---|---|
| Query (required) | The SQL query to run. |
| Database URL (required) | The database connection address, with user and password, for example postgresql://user:password@server:5432/sales. |
| Include Columns | Includes column names in the result. Off by default. |
| Passthrough | If the query fails, returns the query instead of stopping the flow. Off by default. |
| Add Error | With Passthrough on, also adds the error to the result. Off by default. |
Output
The output is the query result as text.
Example
An analyst wants to ask about sales in natural language.
- Connect Natural Language to SQL to turn the question into a query.
- Pass the query to Query and type the database address in Database URL.
- Show the result in the chat.
Good practices
- The address includes the password: use a read-only user. For connections kept in credentials, use components such as Postgres SQL.
Related components
- SQLDatabase: prepares a connection to query in natural language.