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. There is another component with the same name in the prototypes family, SQL Executor, which does the same.
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 |
|---|---|
| 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. |
| Query To Run (required) | The SQL query to run. |
Output
The Text output is the query result.
Example
An analyst wants the day’s order count.
- Type the database address in Database URL.
- Type in Query To Run
SELECT COUNT(*) FROM orders WHERE date = CURRENT_DATE. - Email Text every afternoon.
Good practices
- The address includes the password: use a read-only user. For connections kept in credentials, use components such as Postgres SQL.