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 vannaVerified import paths — ran on the pinned version, not inferred.
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.
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`.
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`.
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'})`.