Hue SQL AI Assistant FAQ

A collection of frequently asked questions about Hue SQL AI Assistant.

General Questions

What is the SQL AI Assistant in Hue?
The SQL AI Assistant in Hue is an AI-powered tool integrated into the SQL editor that helps users generate, edit, optimize, fix, and summarize SQL queries using natural language. It leverages large language models (LLMs) to assist data analysts in making SQL development faster, easier, and less error-prone.
Which SQL dialects does the SQL AI Assistant support?
Multiple SQL dialects are supported, including Hive, Impala, and Trino.

Using SQL AI Assistant

How do I launch the SQL AI Assistant?
Click the Assistant to expand the SQL AI toolbar, which provides buttons for generating, editing, explaining, optimizing, and fixing SQL statements.
For more information, see About setting up the Hue SQL AI Assistant.
What happens when I click 'Generate' in the SQL AI Assistant?
Clicking "Generate" allows you to enter a natural language query, which the assistant converts into an SQL query. The generated SQL is presented along with assumptions made by the LLM.
For more information, see Generating SQL from natural language in Hue.
Can I create a query that joins multiple databases when using the Hue SQL AI Assistant?
Yes, the Hue SQL AI Assistant supports multi-database queries. You can select multiple databases in the AI Assistant Settings pop-up, allowing you to create queries that join tables across different databases.
For more information, see Multi database support for SQL query.
How does the 'Edit' function work?
The "Edit" button allows users to modify an active SQL statement. If an NQL comment precedes the statement, it can be reused by pressing Tab. Users can also enter new instructions for modifications.
For more information, see Editing the query in natural language in Hue.
What do 'Optimize' and 'Fix' do?
  • "Optimize" improves SQL query structure and performance while maintaining the original results.

  • "Fix" automatically corrects syntactic errors and misspellings in the SQL query.

For more information, see Optimizing a query in Hue and Fixing a query in Hue.
How does the 'Explain' function work?
The "Explain" button provides a natural language summary and explanation of the selected SQL query, which can be inserted as a comment in the editor.
For more information, see Getting an explanation of a SQL query in natural language in Hue.

AI Models and Security

Which AI models does the SQL AI Assistant support?
The Hue SQL AI Assistant supports Cloudera AI Workbench and Cloudera AI Inference service, along with several third-party services. Using the Cloudera integrations enhances the Hue SQL AI Assistant by enabling the use of private models hosted within Cloudera-managed infrastructure. This ensures enhanced security and privacy while leveraging GenAI for the Hue SQL-related tasks. For more information, see Supported services.
How does the SQL AI Assistant handle data privacy?
The SQL AI Assistant shares only the data that the logged-in user is authorized to access. It uses a Retrieval Augmented Generation (RAG)-based architecture to limit the number of tables sent per request. However, there is currently no way to explicitly exclude certain tables from being shared.

Configuration and Setup

What AI services are supported for integration?
Supported services include:
Is it necessary to train the Hue SQL AI Assistant on the database schema before using it?
Training is not necessary for the Hue SQL AI Assistant. Once connected, the assistant can begin querying immediately. However, in cases where table names are similar or column names are repeated across multiple tables, it is recommended to ensure that the database metadata is well-maintained. Specifically:
  • Table and column comments should be clear and descriptive as they are used by the assistant for context and disambiguation.
  • Consider using distinct table and column naming conventions to reduce confusion.
  • Ensure that schema and table relationships are properly defined, as this helps the assistant understand context.
Does the Hue SQL AI Assistant only work based on the prompt, or does it also have information about the present databases? For example, can it correct the name of a table or database if I write it incorrectly within the prompt?
Yes, in most cases, the Hue SQL AI Assistant can catch issues with your prompt, such as misspelled table names. This is because the user prompt is packaged alongside information about the SQL dialect in use, the database metadata, and sample rows from relevant tables. However, if another table exists with the misspelled name, the assistant might be misdirected.