In a world where data-driven decision-making is critical, businesses are scrambling to find the most efficient ways to extract actionable insights from massive datasets. Uber, a global leader in real-time logistics and transportation, recently shared how their internal Text-to-SQL platform — QueryGPT (If you haven’t checked out the post, check it out here)— is revolutionizing the way their teams interact with data. By enabling employees to simply ask questions in natural language and receive SQL queries in return, Uber has cut query authoring time by 70%. Considering they run about 1.2 million queries per month, this translates into an astonishing 140,000 hours saved monthly.
Yet, this remarkable efficiency isn’t only for tech giants with vast engineering resources. With the advent of open-source solutions like Wren AI, the Text-to-SQL advantage can be democratized. Wren AI Cloud aims to give businesses of all sizes the power to use natural language queries, powered by generative AI, to seamlessly access their data. In this post, we’ll dissect Uber’s QueryGPT from a technical standpoint and highlight how Wren AI Cloud mirrors (and in some cases simplifies) these complex features. The goal is to help you understand how to implement Text-to-SQL in your own operation — no matter your scale.
Uber’s data platform is a behemoth: it handles trillions of rows, petabytes of data, and millions of queries each month. Traditional SQL authoring is time-consuming and requires users to have strong query-building skills, understand the underlying data models, and know where to find the right tables and columns. QueryGPT removes these roadblocks by using large language models (LLMs) and clever integration into Uber’s existing data ecosystem.
Key Technical Components of designing QueryGPT at Uber, shared in the post of QueryGPT article
Workspaces are curated collections of SQL samples and table schemas aligned with specific business domains, such as Mobility, Ads, Core Services, and more. By creating domain-oriented clusters of relevant tables and query templates, QueryGPT narrows the scope of possible data sources, which significantly improves the model’s accuracy when generating SQL.
How It Works: When a user interacts with QueryGPT, the system will first identify which business domain (e.g., Mobility for trips and drivers) is relevant to the query. Within that workspace, QueryGPT will reference a smaller, more focused set of tables and SQL patterns, rather than scanning through Uber’s entire database ecosystem.
Advantages:
After a user inputs a question in natural language, QueryGPT employs an Intent Agent to interpret the user’s intent and determine the most appropriate workspace(s). This step is vital in ensuring the system directs queries to the correct domain and, by extension, the correct subset of tables.
Once QueryGPT knows which business domain(s) to focus on, the Table Agent proposes a list of specific tables that are most relevant to the user’s request. This step is crucial in large organizations like Uber, where a single domain might contain dozens — or even hundreds — of tables with overlapping or complementary data.
Even with the correct tables identified, large enterprise schemas can contain hundreds of columns, each of which must be described to the language model if there’s a chance it might appear in the query. Such exhaustive detail can hit or exceed token limits during generation, especially when using models like GPT-4 Turbo with high token capacities.
These four components — Workspaces, the Intent Agent, the Table Agent, and the Column Prune Agent — orchestrate a streamlined, highly efficient text-to-SQL generation process at Uber. By segmenting the solution into domain-specific Workspaces, filtering queries through an Intent Agent, validating table choices via a Table Agent, and pruning unnecessary columns before the final query is generated, QueryGPT ensures high accuracy, cost savings, and quick turnaround. This approach empowers users to interact with Uber’s complex data ecosystem through simple, natural language questions — raising the bar on data accessibility and operational efficiency across the company.
Technically, QueryGPT is a marvel of LLM integration, prompt engineering, and systems design. The business outcomes reflect this technical mastery:
Uber’s QueryGPT is undoubtedly impressive, but it’s tailored for a massive organization with extensive engineering resources. How can a growing startup, a mid-sized enterprise, or even a solo data practitioner tap into similar technologies? This is where Wren AI comes into play.
Wren AI is an open-source SQL AI agent designed to democratize Text-to-SQL technology. By offering a cloud-based platform that integrates many of the same features as Uber’s QueryGPT, Wren AI aims to level the playing field.
Below is an overview of how Uber’s QueryGPT design aligns with and maps to Wren AI’s features, illustrating how similar principles of workspace separation, intent detection, table selection, and column pruning are implemented in both systems. These parallels demonstrate a shared commitment to delivering a streamlined, secure, and user-friendly text-to-SQL experience.
In QueryGPT, Workspaces serve as curated collections of SQL samples and table schemas for specific domains, such as Mobility or Core Services. By narrowing the focus to a particular business domain, QueryGPT can more accurately generate SQL queries and ensure that data analysts only interact with context-relevant tables.
Wren AI offers similar functionality through its project and organization management features. You can read more about creating organizations and projects in the Wren AI Cloud documentation:
Just like QueryGPT’s Workspaces, Wren AI’s projects let you group and isolate specific data models so that only authorized users can access them. Within a single organization, you can set up multiple projects for different functions or business domains — similar to how QueryGPT sets up separate Workspaces. Access controls in Wren AI ensure that only the right people can view and manage sensitive data, aligning with the same principles of domain-scoped isolation seen in QueryGPT.
When a user inputs a question, QueryGPT’s Intent Agent identifies which business domain the question belongs to — Mobility, Ads, etc. — and routes the query to the corresponding workspace. This step dramatically narrows the search space for relevant tables and schemas, improving accuracy and speed.
Wren AI’s approach to intent detection is described in the Ask documentation. When you ask a question like “How many tables do I have?” or “Explain the customer table to me,” Wren AI automatically discerns whether you’re requesting data retrieval, schema exploration, or if your question falls out of scope (e.g., a casual greeting).
In QueryGPT, once the correct domain is identified, the Table Agent proposes which specific tables are necessary to construct the SQL query. Users can either confirm these suggestions or edit them to ensure alignment with their real-world data expertise.
In Wren AI, this step corresponds to the table retrieval phase, where we use semantic search to select the top 10 tables most relevant to the user’s question. We look at each table name and its metadata — such as descriptions or tags — to determine the best matches before generating the query.
Large data schemas in enterprise environments can have hundreds of columns per table, potentially hitting token limits when feeding this data into an LLM. The Column Prune Agent filters out unnecessary columns to avoid overloading the model, cutting down on both latency and cost.
Wren AI’s Column Prune Agent serves an identical function: when you connect large numbers of tables and columns, Wren AI prunes those columns that aren’t relevant to the query or the user’s immediate needs. This keeps the system fast, efficient, and affordable to operate at scale.
Beyond its robust text-to-SQL functionality, Wren AI delivers a host of additional features that make data analysis even more convenient, interactive, and accessible for teams of all technical backgrounds.
Wren AI automatically generates insightful charts to visualize your data and uncover meaningful patterns — no additional steps required.
Learn more: https://docs.getwren.ai/oss/guide/home/chart
Boilerplates in Wren AI are pre-defined templates designed to simplify your data analysis journey from start to finish.
Learn more: https://docs.getwren.ai/oss/guide/boilerplates/overview
This breakdown walks users through how the AI arrives at certain tables and columns, culminating in the final SQL query.
Learn more: https://docs.getwren.ai/cloud/guide/home/answer#result-steps
Wren AI makes it easy to share and manipulate query results in familiar spreadsheet tools.
Learn more:
By incorporating text-to-chart, boilerplates, and deep spreadsheet integrations, Wren AI goes beyond text-to-SQL to deliver a comprehensive, user-friendly ecosystem for data analytics. Whether you need a quick visualization, ready-to-use templates for common data questions, or seamless export to your preferred spreadsheet tool, Wren AI has you covered.
Both Uber’s QueryGPT and Wren AI share a modular design that solves text-to-SQL challenges by leveraging key steps — workspace or project segmentation, intent detection, table selection, and column pruning. This structured approach ensures accurate, efficient, and scalable SQL generation while maintaining strict data governance and security.
If you’re looking for a powerful, open-source text-to-SQL solution that brings these innovations to your organization, Wren AI offers everything you need to transform how your team interacts with data. With project and organization management, intent detection, step-by-step SQL breakdowns, and column pruning, Wren AI ensures that data is accessible, accurate, and secure — whether you’re a data analyst, engineer, or business leader.
👉 Explore Wren AI’s open-source project on GitHub: https://github.com/Canner/WrenAI
👉 Learn more and try Wren AI today: https://getwren.ai/
Start simplifying your data workflows and empower your team to get insights faster — no manual SQL writing required.
Supercharge Your Data with AI Today?!