Skip to content

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.

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.

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.

ParameterRequiredTypeSuggested scopeWhat it does
data_product_idYesstringUser inputThe data product to query against.
sqlYesstringAgent determinedThe query to run.
result_table_nameYesstringAgent determinedA short, descriptive name for the result table.
data_product_versionNostringFixed or User inputA specific version of the data product.
pre_exec_sqlNostringFixedSQL to run before the main query, e.g. to set session context.
auth_idNostringFixed or User inputThe authentication credentials to use for the query.
auth_modeNostringFixedControls credential resolution. Leave unset (Default) to resolve the user’s credential first then fall back to a shared service account. Set to mde_credentials to force the datasource’s MDE service account. Admin-only.
{
"data_product_id": "my-data-product",
"sql": "SELECT region, SUM(amount) FROM sales GROUP BY region;",
"result_table_name": "sales_by_region"
}

The query result as a table. Very large results may have rows or columns trimmed.