vanna

🤖 Chat with your SQL database 📊. Accurate Text-to-SQL Generation via LLMs using Agentic Retrieval 🔄.

23.2k
Stars
+315
Stars/month
4
Releases (6m)

Star Growth

+47 (0.2%)
22.7k23.2k23.6kMar 27Apr 1

Overview

Vanna是一个将自然语言转换为SQL查询的AI工具,让非技术用户能够通过聊天方式查询数据库。该工具使用大语言模型进行智能的文本到SQL转换,并通过检索增强生成(RAG)技术提高查询准确性。Vanna 2.0版本在原有功能基础上增加了企业级安全特性,包括用户感知的权限控制、行级安全、审计日志和速率限制。它提供了开箱即用的现代化Web界面,支持实时流式响应,用户可以看到SQL代码、交互式数据表格、Plotly可视化图表和自然语言总结。该工具支持几乎所有主流数据库(PostgreSQL、MySQL、Snowflake、BigQuery等)和LLM提供商(OpenAI、Anthropic、Google Gemini等),可以与现有的认证系统无缝集成。其预构建的<vanna-chat>Web组件可以轻松嵌入到任何网页中,支持React、Vue或纯HTML,让开发者无需从零构建聊天界面。

Deep Analysis

Key Differentiator

Production-ready text-to-SQL with built-in web UI, row-level security, and streaming rich components — unlike generic LLM wrappers, Vanna 2.0 is an agent framework purpose-built for secure, user-aware database interactions

Capabilities

  • Natural language to SQL conversion
  • Streaming responses with tables, charts, and summaries
  • User-aware row-level security
  • Pre-built <vanna-chat> web component
  • Custom tool extensibility
  • Lifecycle hooks for rate limiting, audit logs, and content filtering
  • LLM middleware for caching and prompt engineering

🔗 Integrations

OpenAIAnthropicOllamaGoogle GeminiAWS BedrockMistralPostgreSQLMySQLSnowflakeBigQuerySQLiteOracleSQL ServerDuckDBClickHouseFastAPIFlask

Best For

  • Building natural language database interfaces for business users
  • Enterprise data analytics apps with per-user security and audit trails

Not Ideal For

  • Non-SQL data analysis (NoSQL, file-based)
  • Simple one-off SQL generation (overkill — use a prompt)

Languages

PythonJavaScript

Deployment

pip installFastAPI integrationSelf-hostedWeb component embed

Pricing Detail

Free: Fully open source (MIT)
Paid: N/A — free

Known Limitations

  • SQL-centric — not for non-SQL data sources
  • V2.0 is a complete rewrite — migration from 0.x needed
  • Requires LLM API for SQL generation — accuracy depends on model quality
  • Web component requires server-side backend

Pros

  • + 支持广泛的数据库和LLM提供商,具有很强的兼容性和灵活性
  • + 提供企业级安全特性,包括用户权限控制、审计日志和行级安全
  • + 包含预构建的现代化Web界面组件,支持实时流式响应和丰富的数据可视化

Cons

  • - 需要LLM API访问权限,使用成本可能较高
  • - 需要对数据库schema有一定了解才能获得最佳查询效果
  • - 企业级功能的配置和部署相对复杂

Use Cases

  • 为非技术业务用户提供自然语言数据查询界面
  • 构建内部数据探索和分析工具,降低SQL查询门槛
  • 集成到现有应用中提供智能化的数据报告和洞察功能

Getting Started

1. 安装vanna包并配置数据库连接;2. 选择并配置LLM提供商(如OpenAI、Anthropic等);3. 在网页中嵌入<vanna-chat>组件或使用Python API开始自然语言查询

Compare vanna