Skip to content
Preprint

Generating Query Context for Relational Databases

Aug 2026 · 0 citations · 36 references
Computer Science

TL;DR

This work presents an automated approach for generating query context for relational databases that defines query flows that capture common patterns of data retrieval and analysis questions, systematically generates data models by traversing these flows, and instantiates them with specific values sampled from the database using weighted strategies that maximize diversity and coverage.

Abstract

Relational databases are the systems of record for business applications, and there is growing demand to query them through natural language interfaces. A key challenge is that AI models need appropriate query context, i.e., sample questions paired with their corresponding data-model fragments, to generate accurate SQL. Today, creating this context is a manual, time-consuming process that requires expertise in both SQL and the database schema, leading to a cold start problem for new databases and an ongoing maintenance burden as schemas and query patterns evolve. We present an automated approach for generating query context for relational databases. Our method defines query flows that capture common patterns of data retrieval and analysis questions, systematically generates data models by traversing these flows, and instantiates them with specific values sampled from the database using weighted strategies that maximize diversity and coverage. The resulting question--data-model pairs can be used to guide natural language interfaces in accurately querying relational databases. We report on our experience deploying this approach across more than 50 real-world databases connected to Tursio.

View source

Similar papers

Open access Sep 2026

NATURAL LANGUAGE TO SQL QUERY GENERATOR

The Natural Language to SQL Query Generator is an intelligent system designed to allow users to retrieve information from databases by asking questions in simple natural language. Traditionally, users need knowledge of SQL syntax to interact with relational databases. This creates difficulties for non-technical users w...

B. Divya, V. Vaishnavi, E. H. Charan et al. · 0 citations
Preprint Aug 2026

MDB-Link: Hierarchical Schema Linking for Multi-Database Text-to-SQL

This work proposes MDB-Link, a hierarchical schema-linking framework that retrieves question-relevant columns from a global index, aggregates retrieval evidence to shortlist databases, and uses a budget-aware large language model (LLM) for database reranking, table selection, and column grounding.

Beiyu Xu, Zhenyu Wu, Jiao-Yan Chen et al. · 0 citations
Preprint Sep 2026

From Data Querying to Data Investigations: Rethinking Natural Language Interfaces for Databases

Natural language (NL) interfaces to databases have been optimized for the wrong problem. The dominant Text-to-SQL paradigm assumes that users ask questions that can be answered by single SQL queries. In practice, however, users seek assistance with solving data problems. This requires searching a database by sequences...

Fabian Wenz, Zi-Xuan Chen, Carsten Binnig · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.