Registry / llm-agents / vanna
library2.0.2pypypi✓ verified 87d ago

Vanna is a Python library that enables users to generate SQL queries from natural language, visualize results, and get answers, now with enterprise security and user-aware permissions. Version 2.0.2 is a complete rewrite, focusing on better support for agentic models and an improved user-aware framework. The library maintains an active development pace with frequent updates.

pip install vanna
INSTALL
IMPORT
SIG · VANNA
V
vanna
llm-agentspythonv2.0.2
Install
15.1s avg
Import
—
Disk
289MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v2.0.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 285.4MB
glibc
py 3.10–3.910 runs
installs and imports cleanly · install 15.1s · import 0.000s · 276MB
289MB installed
● package 289MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Agent
✓ from vanna import Agent
✗ from vanna.local import VannaDefault

This quickstart demonstrates how to use `VannaDefault` for a local setup. It initializes Vanna with OpenAI and a local DuckDB, trains it with schema and example questions, and then generates and runs SQL for a natural language query. Ensure you have the `OPENAI_API_KEY` environment variable set or replace the placeholder.

import os from vanna.local import VannaDefault import pandas as pd # For local testing, VannaDefault uses DuckDB and OpenAI as defaults. # Ensure OPENAI_API_KEY is set in your environment. # pip install "vanna[duckdb]" "vanna[openai]" # Initialize VannaDefault with your OpenAI API key and preferred model vn = VannaDefault( model='gpt-4o', api_key=os.environ.get('OPENAI_API_KEY', 'YOUR_OPENAI_API_KEY'), # Replace with actual key or set env var path='my_vanna_db' # Path for local ChromaDB and DuckDB storage ) # Connect to a database (DuckDB is default for VannaDefault) vn.run_sql_query("CREATE TABLE sales (id INT, product TEXT, amount INT)") vn.run_sql_query("INSERT INTO sales (id, product, amount) VALUES (1, 'Apple', 100), (2, 'Banana', 150)") # Train Vanna with DDL, documentation, and example questions/SQL vn.train(ddl="CREATE TABLE employees (id INT, name TEXT, salary INT)") vn.train(question="What are the total sales for each product?", sql="SELECT product, SUM(amount) FROM sales GROUP BY product") vn.train(sql="SELECT * FROM sales", df=pd.DataFrame({'id': [1], 'product': ['Apple'], 'amount': [100]})) # Ask a question question = "Show me the sum of sales for each product" sql = vn.generate_sql(question=question) print(f"Generated SQL: {sql}") # Run the generated SQL if sql: results = vn.run_sql(sql=sql) print(f"Query Results:\n{results}") else: print("Could not generate SQL for the question.")
Debug
Known issues
breakingVanna 2.0.0 represents a complete architectural rewrite. Code written for pre-2.0 versions will likely break due to significant API changes, especially around `Vanna` class instantiation, training methods, and connector configuration.
fix
Refer to the Vanna 2.0 documentation and migration guides. Re-architect your Vanna instance creation using the new inheritance model (e.g., `class MyVanna(VectorStore, LLM, VannaBase)`) or use `VannaDefault` for quick setups. Update method calls like `train_sql` to `train`.
affects: <2.0.0
gotchaVanna requires additional packages for specific LLMs (e.g., OpenAI, Anthropic) and Vector Stores (e.g., ChromaDB, Pinecone, pgvector). The base `pip install vanna` does not include these.
fix
Install Vanna with the necessary extras, e.g., `pip install "vanna[openai]"` for OpenAI integration, `pip install "vanna[chromadb]"` for ChromaDB, or `pip install "vanna[duckdb]"` for local DuckDB use with `VannaDefault`.
affects: >=1.0.0
gotchaAPI keys for LLMs (like OpenAI) are critical for Vanna's functionality. Incorrect or missing keys will lead to authentication errors.
fix
Ensure your LLM API key is correctly configured. For OpenAI, set the `OPENAI_API_KEY` environment variable or pass it directly in the `config` dictionary when initializing your LLM component, e.g., `OpenAI_Chat(config={'api_key': 'YOUR_KEY'})`.
affects: >=1.0.0
Install Issues
1 verified issue
ImportError: cannot import name 'vanna' from 'vanna'All platforms · Python 3.9 · 3.10 · 3.11 · 3.12 →
Upgrade
Version history
2.0.2latest on PyPI · released Feb 2, 2026
Audit
Dependencies
openaioptionalRequired for using OpenAI models (e.g., GPT-4o). Install with 'pip install "vanna[openai]"'.
chromadboptionalA common vector database backend for Vanna. Install with 'pip install "vanna[chromadb]"'.
duckdboptionalDefault database for `VannaDefault` for local testing. Install with 'pip install "vanna[duckdb]"'.
Agent activity
69 hits · last 30 days
node
63
Perplexity
1
OpenAI (training)
1
Resources
vanna — pip install vanna · libregistry