Data Explorer SQL AI API overview (Technical Preview)

The Data Explorer SQL AI REST API enables programmatic integration with Large Language Models to perform automated SQL query generation, edit, explain, optimize, fix, and comment through a RESTful API, enabling programmatic access and integration with external tools.

Supported SQL AI tasks

The single /api/v1/ai/assistant endpoint serves all SQL AI operations. You can specify the target operation by using the task field in the request payload.

  • Generate — Generates a new SQL query from a natural-language request.
  • Edit — Modifies an existing SQL query based on a natural-language instruction.
  • Explain — Provides a plain-language explanation of a SQL query.
  • Optimize — Rewrites a SQL query to enhance execution performance.
  • Fix — Corrects syntax errors, invalid references, and logical errors in a SQL query.
  • comment — Inserts inline /* comments */ into a SQL query.

Supported SQL dialects

  • hive
  • impala
  • trino
  • mysql

Prerequisites

Before accessing the SQL AI REST API, verify that the following prerequisites are met:

  • The SQL AI Assistant API is enabled in the desktop > ai_interface section of the hue-safety-valve configuration file by setting the assistant_api_enabled property to true. If the assistant_api_enabled property is set to false, requests return a 403 Forbidden error response.
  • An LLM provider such as OpenAI, Azure OpenAI, or Bedrock is configured along with the necessary metadata search settings.

Limitations

  • Complex or large schemas can cause longer response times during metadata lookup.
  • Schema lookup and response accuracy are continuously optimized across service pack releases.