Agents in the Wild

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
Pinterest
Industry
Social Media
When
2024
Evidence
Company reported
Agents and tools
QuerybookRAGLLM

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

  1. Text-to-SQL system with RAG-enhanced table selection — ZenML LLMOps Database, 2024

Added Oct 16, 2026. Spotted an error? Send a correction.

Get new use cases weekly

One short email. Sources included.

Related use cases