Transform natural language questions directly into SQL. The AlloyDB AI natural language feature (Preview) translates natural language queries into schema—aware SQL queries, empowering both developers and analysts to get answers faster.
-
Build a semantic layer
Create a rich semantic layer by understanding your tables, columns, and relationships to generate accurate, context-aware queries.
-
Intelligent SQL generation
Intelligently parse intent using concept search and leverages a template store of templates to rapidly and reliably construct SQL queries.
-
Parameterized secure views
Provide fine-grained access control, ensuring that end users only see data they're authorized to access, which is critical for applications executing AI-generated queries.
How it works
AlloyDB AI natural language (Preview) feature is designed to work securely with your database schema. After registering your schema objects with a natural language configuration, you can call the alloydb_ai_nl.get_sql()
function from your application to translate plain English questions into SQL queries, or use explain_sql
to understand a query. The feature integrates with standard PostgreSQL roles and IAM for security, and you can use parameterized secure views for fine—grained access control.
To accelerate setup and ensure accuracy, AlloyDB includes productivity tools for automatic context generation from your schema. These tools automatically generate schema context and suggest query templates, reducing the manual effort required to get started. You can further refine results by adding business—specific query templates to the template store. The underlying model can generate complex SQL—including multi—table joins, aggregations, and window functions—based on user intent and schema context, with accuracy improving as more context and templates are provided.

Use cases
Explore how you can apply AlloyDB AI natural language queries can be applied to common business scenarios.

Learn more
Explore Google developer resources to build your natural language query applications with AlloyDB.
-
Conversational App Tutorial
Learn to build a conversational commerce app with AlloyDB AI and Serverless.
-
Developer How-To Guide
A step—by—step technical guide on setting up, configuring, and using the
get_sql()
function. -
Developer Codelab
Get practical experience with a guided tutorial on generating SQL from natural language.