SQL Execution Tool
SQL Execution Tool
Section titled “SQL Execution Tool”This tool runs a SQL query against the database behind a data product and returns the result as a table. It is the workhorse behind agents like Query, Data Product Query, and Analytics Agent.
Queries are read-only. Mutating statements (UPDATE, DELETE, INSERT, and so on) are not allowed. The data product must be backed by a SQL-compatible data source.
When to use it
Section titled “When to use it”Add this tool to any agent that needs to answer questions from data by running queries. Pair it with Get Data Schema so the agent can learn the available tables and columns first.
Supported databases
Section titled “Supported databases”Agent Studio recognizes the data source’s SQL dialect and parses, validates, and normalizes every query to it — a query written in generic SQL is rewritten into syntax the target database accepts. Supported dialects are:
- Amazon Redshift
- Databricks
- Google BigQuery
- IBM DB2
- Microsoft SQL Server
- Oracle
- PostgreSQL
- SAP HANA
- Snowflake
- Teradata
- Trino (formerly PrestoSQL)
If you need a dialect that is not listed, contact Alation to inquire about support.
Parameters
Section titled “Parameters”| Parameter | Required | Type | Suggested scope | What it does |
|---|---|---|---|---|
data_product_id | Yes | string | User input | The data product to query against. |
sql | Yes | string | Agent determined | The query to run. |
result_table_name | Yes | string | Agent determined | A short, descriptive name for the result table. |
data_product_version | No | string | Fixed or User input | A specific version of the data product. |
pre_exec_sql | No | string | Fixed | SQL to run before the main query, e.g. to set session context. |
auth_id | No | string | Fixed or User input | The authentication credentials to use for the query. |
auth_mode | No | string | Fixed | Set to datasource_service_account to let the query use an admin-configured shared service account when the user has no credentials of their own. Requires the service account feature. |
allow_fallback_auth | No | boolean | Fixed | When true, falls back to the data source’s default credentials if the user has none. |
Example usage
Section titled “Example usage”{ "data_product_id": "my-data-product", "sql": "SELECT region, SUM(amount) FROM sales GROUP BY region;", "result_table_name": "sales_by_region"}Output
Section titled “Output”The query result as a table. Very large results may have rows or columns trimmed.