Schema-Aware Query Translation and Tabular Reasoning for Enterprise Databases
Abstract
Relational Database Management Systems (RDBMS) hold the vast majority of structured enterprise data. However, applying Large Language Models (LLMs) to perform natural language querying and tabular reasoning directly over relational schemas presents major bottlenecks: full schema injection quickly exhausts context windows, complex join relationships lead to hallucinated SQL syntax, and security risks like invalid query execution constrain enterprise adoption. To overcome these limitations, we present Schema-Aware Query Translation and Tabular Reasoning for Enterprise Databases aka Inference-from-RDBMS, an open-source framework designed for schema-aware query translation, dynamic context pruning, and execution-guided tabular inference over complex RDBMS structures. The framework extracts database metadata to construct an interactive Schema Relationship Graph (SRG), prunes unreferenced tables and foreign-key joins using semantic distance metrics, and passes a minimal schema sub-graph to an execution-validated text-to-SQL generator. We evaluate Inference-from-RDBMS across standard enterprise benchmarks (including SPIDER and real-world multi-table schemas). The experimental results demonstrate that our framework achieves an 88.4% execution accuracy, reduces prompt token overhead by 52%, and cuts end-to-end query translation latency by 41% compared to standard schema-injected baseline models. These results position Inference-from-RDBMS as a robust, secure, and cost-efficient solution for natural language database interfaces in large-scale AI applications.