Skip to main content
Executes a SQL query equivalent of the given natural-language question using the specified SQL-GPT context.
EXECUTE_AI_QUERY Table Function Syntax

Parameters

<question>

Natural-language question for which an equivalent SQL query will be executed

<schema name>

Name of the schema containing the context to use in generating the query

OPTIONS

SQL generation options, specified as a set of key/value pairs passed as a comma-delimited list of <key> = '<value>' assignments to the KV_PAIRS function; e.g.:

SQL Generation Options

The following options can be specified to modify the way the executed SQL query is generated.

ai_api_provider

Name of an LLM service to use other than the default one; the default, sqlgpt, uses the Kinetica SQLGPT.io service.

ai_api_url

URL of an LLM service to use other than the default one.

context_name

Name of the SQL-GPT context to use in generating the executed query; should be of the form [<schema name>.]<context name>.

context_names

Comma-separated list of names of SQL-GPT contexts to use in generating the executed query; each should be of the form [<schema name>.]<context name>, and the entire list should be single-quoted.For example:

use_rag

Whether to use retrieval-augmented generation (RAG) facilities with the given SQL-GPT contexts when processing this request.

SQL Execution Examples

To execute the SQL equivalent query to a given question using the example.atc_ctx SQL-GPT context:
EXECUTE_AI_QUERY Example
To execute the SQL equivalent query to a given question using the nyctaxi_ctx & flights_ctx SQL-GPT contexts with SQL RAG:
EXECUTE_AI_QUERY with RAG Example