Development

How QueryData Transforms Natural Language into Database Queries Across AlloyDB, Cloud SQL, and Spanner

· 5 min read

QueryData launches in preview today as a tool for translating natural language into database queries with near-100% accuracy. The service enables developers to build agentic experiences across AlloyDB, Cloud SQL (for MySQL and PostgreSQL), and Spanner (for GoogleSQL). It builds on Google Cloud's #1 ranking in the BiRD benchmark, a leading natural-language-to-SQL benchmark, and leverages Gemini-assisted context engineering.

Hughes Network Systems, a telecommunications leader, has already deployed QueryData in production. "We have transformed user support operations with Google Cloud's data agents. At the heart of our solution is QueryData, enabling near-100% accuracy in production. We are excited about the future of agentic systems!" Amarender Singh Sardar, Director of AI, Hughes Network Systems

The opportunity for agentic systems: from intent to action

Agentic systems are shifting from advisory roles to active decision-makers. To execute business actions accurately, agents need precise information from operational databases—pricing, inventory, transaction records, and more.

When requests arrive in natural language, bridging the gap between conversational input and structured database records becomes essential. High-quality natural language-to-query translation is critical for enabling agents to take meaningful action.

2

The developer's dilemma: why natural language for agents with databases is hard

Agents querying enterprise data face three major hurdles: accuracy, security, and ease of use. QueryData addresses all three:

  • Accuracy – Inaccurate answers risk poor business decisions, disappointed users, or financial losses. In many industries, 90% accuracy in text-to-SQL translation is insufficient for taking action.

  • Security – Enterprises need auditable, deterministic access controls to ensure each person or agent queries only authorized data. Relying on LLM judgment—probabilistic access controls—falls short. Even a low risk of security breaches can mean disproportionately high losses.

  • Ease of use – Achieving high accuracy requires developers to provide extensive contextual information about their data, which can be laborious. Integration and maintenance of agentic tools adds further friction.

Understanding the accuracy gap

LLMs excel at writing query code, but accurate queries for a given database require more than coding skills and schema parsing:

  • Schemas can be unclear – Developers often use shorthands or abbreviated names. What does a column named "product" mean? A product category? A specific model? It gets worse with names like "prod" or simply "p."

  • Values can be ambiguous – Consider a column named "order return status" with integer values: "1," "2," and "3." Which represents "returned" or "return initiated"?

  • Schemas cover data structure, not business logic – Your business may define "monthly active users" as those who posted at least once, not just logged in, but the database may lack this nuance.

  • Underspecified queries – Natural language questions can be ambiguous, like "latest sales."

3

How QueryData achieves near-100% accuracy

QueryData leverages the Gemini LLM along with context that describes your unique database.

Database context—essentially the code powering QueryData—consists of descriptions and instructions including:

  • Schema ontology – Information about the meaning of the data. Descriptions of columns, tables, and values help QueryData overcome ambiguity by determining what data is needed to answer the question.

  • Query blueprints – Guidelines and explicit instructions for writing database queries to answer specific types of questions. Templates and facets specify the exact SQL to write for a given question type.

As a last resort, QueryData will detect when a clarifying question needs to be asked.

4

Deterministic security for your queries

Agentic applications require deterministic, auditable security. Developers can use Parameterized Secure Views (PSVs) to define agent access via fixed parameters like user ID or region. By passing these security-critical parameters separately from queries, the application ensures agents can only access authorized data. This prevents agents from querying restricted information, even if they attempt to do so.

Support for PSVs is available today in AlloyDB, with Cloud SQL and Spanner support coming soon.

5

Ease of use for quality optimization and tool integration

Integrating QueryData into your agentic workflows is straightforward. The QueryData API can be used directly or exposed as a Model Context Protocol (MCP) tool via the open source MCP Toolbox for Databases. QueryData automatically works across different database dialects—no need for database-specific code, just one API to query them all.

QueryData also simplifies context engineering, the process of iteratively evaluating and optimizing context. This is critical to QueryData's ability to accurately query your database. Developers using QueryData benefit from a robust suite of tools:

  • Out-of-the-box context generation – Upon configuring QueryData, the Context Engineering Assistant, a dedicated agent in Gemini CLI, helps you create the initial context set for your database.

  • Evals: Developers can use the bundled Evalbench framework to measure accuracy against a set of tests specific to your use case.

  • Context optimization: The Context Engineering Assistant analyzes evaluation results and suggests refinements to improve accuracy. By running evaluations iteratively based on these recommendations, you can achieve accuracy rates approaching 100%.

Real-world QueryData applications

Developers are already deploying QueryData across diverse use cases:

  • Customer-facing applications: A real estate search platform uses QueryData to convert natural language queries into database lookups and automatically schedule property viewings

  • Internal tools: An AI-powered workforce management system queries HR databases to help managers assign employees to shifts based on availability and skills

  • Multi-agent architectures: A trade compliance workflow where a primary agent delegates KYC verification to a specialized sub-agent, which queries customer databases to validate identity and compliance status
6

Getting started with QueryData

QueryData is available now for integration into your agentic applications. Consult the technical documentation for your database platform:

For a practical demonstration, explore the Swiss property search demo shown below (video walkthrough). This independent project illustrates QueryData's capabilities in a real-world scenario: view on GitHub. Note that this demo is not maintained by Google Cloud and is provided for illustrative purposes only.

7