Pinterest's text-to-SQL agent helps analysts find tables and write queries 35% faster
Pinterest added an LLM SQL generator to Querybook, its open-source SQL tool, then added retrieval to pick the right tables from a very large warehouse.
- Organization
- Industry
- Social Media
- When
- 2024
- Evidence
- Company reported
Reported outcome
Pinterest reports 35% faster task completion for SQL writing, and first-shot acceptance rising from 20% to over 40%.
- +35%Task speed
- 20% → 40%+First-shot acceptance
Caveats
Stated by the company that uses the agent (blog, earnings call, interview). Not independently audited.
- The speed figure is from Pinterest's internal data and does not control for task differences.
- We could only confirm figures from secondary write-ups so far.
What the agent does
An analyst asks a question in plain English. The system searches table descriptions to find likely tables, shows them to the analyst, then writes a SQL query using those tables' schemas.
Why table search matters
In a warehouse with a huge number of tables, the hard part is often which table, not the SQL. Pinterest added retrieval because users could not find the right tables.
What to copy
- Write short descriptions for your most-used tables. Retrieval is only as good as these.
- Let the user confirm the tables before the model writes SQL.
- Track first-shot acceptance as your main quality metric.
Starter prompt
Written by us.
Question: {question}
Candidate tables (with column descriptions):
{retrieved_table_schemas}
1. Pick the tables you need and say why in one line each.
2. Write one SQL query for {dialect}. Use explicit column names.
3. List assumptions (date ranges, filters, how you handled NULLs).
If none of the tables fit, say so instead of guessing.
Sources
- Text-to-SQL system with RAG-enhanced table selection — ZenML LLMOps Database, 2024
Added Oct 16, 2026 · Sources last checked Nov 16, 2026.
Get new use cases weekly
One short email. Sources included.
The newsletter is paused. Past issues stay in the archive.
Related use cases
Uber's QueryGPT turns plain-English questions into SQL, cutting query time from ~10 to ~3 minutes
Uber estimates a query that took about 10 minutes to write by hand now takes about 3 minutes; the limited release reached ~300 daily active users.
Uber's Genie answers on-call questions in Slack and saved ~13,000 engineering hours
70,000+ questions answered across 154 Slack channels, with an estimated 13,000 engineering hours saved.
GitHub's Qubot lets staff query the data warehouse in plain language, with hundreds of users
Hundreds of users running thousands of queries. In GitHub's experiments, curated context made Qubot three times faster at returning the right answer.