Agents Lookup

Use cases / Data & analytics

Self-hosted text-to-SQL for a private database

Run an open-source text-to-SQL library against your own database, trained on your schema and example queries, inside your network.

DifficultyIntermediate
Setup timeHalf a day
CategoryData & analytics

The use case

Some teams cannot send schemas or data to a hosted analytics tool. Vanna is an open-source Python library that learns from your schema, documentation and example question-SQL pairs, then generates SQL for new questions and can run it against Postgres, Snowflake, BigQuery and others. It can use a local or hosted model. A data engineer controls what it is trained on and which database user it runs as. Analysts review generated SQL, and the connection should use a read-only account.

Example workflow

  1. Install the library and choose a model
  2. Load schema, docs and example queries
  3. Connect with a read-only database user
  4. Ask questions and review SQL
  5. Add corrected queries as new examples

Tools

Risks and guardrails

Sources

Written by Agents Lookup. Credits and official pages for the tools this use case names: