Vanna: Chat with Your SQL Database Using LLMs and Agentic Retrieval

Summary
Vanna is an open-source Python library that enables natural language interaction with SQL databases, leveraging Large Language Models (LLMs) for accurate text-to-SQL generation. Version 2.0 introduces enterprise-grade features like user-aware permissions, a modern web interface, and streaming responses, making it ideal for secure and scalable data analytics applications.
Repository Info
Tags
Click on any tag to explore related repositories
Introduction
Vanna is an innovative open-source Python framework designed to transform natural language questions into actionable data insights from your SQL database. Leveraging Large Language Models (LLMs) and agentic retrieval, Vanna accurately generates SQL queries, making data accessible to a wider audience. The latest Vanna 2.0 release brings significant enhancements, focusing on enterprise-grade security, user-aware permissions, and a modern, streaming web interface. It allows users to effortlessly chat with their SQL database, receiving real-time progress updates, generated SQL code (for admins), interactive data tables, Plotly charts, and natural language summaries, all streamed directly to a web component.
Installation
Getting started with Vanna is straightforward. For a comprehensive guide and quick setup, refer to the official documentation:
Examples
Vanna provides a pre-built web component, <vanna-chat>, that can be easily embedded into any webpage, offering a rich, interactive experience.
Here's how you can drop the Vanna chat component into your HTML:
<!-- Drop into any existing webpage -->
<script src="https://img.vanna.ai/vanna-components.js"></script>
<vanna-chat
sse-endpoint="https://your-api.com/chat"
theme="dark">
</vanna-chat>
This component uses your existing cookies/JWTs and works seamlessly with frameworks like React, Vue, or plain HTML. Users can ask questions in natural language, and Vanna will return streaming progress updates, SQL code blocks (optionally for admins), interactive data tables, charts, and natural language summaries, all in real-time.
Why Use Vanna
Vanna 2.0 is built for production and offers a compelling set of features:
- Get Started Instantly: It provides a production-ready chat interface and a custom agent that integrates with your database, easily embeddable in any webpage.
- Enterprise-Ready Security: Features user-aware permissions at every layer, row-level security, comprehensive audit logs for compliance, and rate limiting via lifecycle hooks.
- Beautiful Web UI Included: The pre-built
<vanna-chat>component eliminates the need to build your own chat interface, offering streaming tables and charts, responsive design, customizable themes, and framework-agnostic compatibility. - Works With Your Stack: Vanna is highly flexible, supporting various LLMs (OpenAI, Anthropic, Google Gemini, etc.), databases (PostgreSQL, MySQL, Snowflake, BigQuery, etc.), your existing authentication systems (cookies, JWTs, OAuth), and popular frameworks like FastAPI and Flask.
- Extensible But Opinionated: It allows for custom tools, lifecycle hooks for quota checking and logging, LLM middlewares for caching and prompt engineering, built-in observability, and context enrichers for RAG and memory.
Links
For more detailed information, guides, and community support, please visit the official Vanna resources: