AlloyDB AI natural language overview

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.

AI-powered filtering thumbnail

Create a rich context layer by understanding your tables, columns, and relationships to generate accurate, context-aware queries.

In-database text generation thumbnail

Intelligently parse intent using concept search and leverages a template store of templates to rapidly and reliably construct SQL queries.

Direct model integration thumbnail

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.

Visual overview of AlloyDB AI natural language

Use cases

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

Use Case Business Goal Sample Question Business Impact
Sales Analytics Track sales performance and identify top reps "Who were our top 3 sales reps by revenue in Austin for the last quarter?" - Accelerated Decisions
- Immediate, self-service sales analytics.
Product Adoption Understand user behavior and feature adoption "How many users on our 'Pro' plan used the new reporting feature last week?" - Faster Iteration
- Quickly validate hypotheses and build better products.
Supply Chain Monitor supply chain and identify bottlenecks "Show me all shipments from the Reno warehouse that are delayed by more than 3 days." - Improved Efficiency
- Proactively solve operational issues.
Customer Support Analyze support tickets to find trends "What is the most common complaint category for tickets created in the last 7 days?" - Better Service
- Identify and resolve customer issues faster.

Learn more

Explore Google developer resources to build your natural language query applications with AlloyDB.

Tutorial

Learn to build a conversational commerce app with AlloyDB AI and Serverless.

Guide

A step-by-step technical guide on setting up, configuring, and using the get_sql() function.

Codelab

Get practical experience with a guided tutorial on generating SQL from natural language.