GitHub – vanna-ai/vanna: Chat with your SQL database. Accurate Text-to-SQL Generation via LLMs using RAG.
Chat with your SQL database, without becoming a SQL wizard
If you’ve ever wanted to ask natural questions of your database, and get back real SQL you can run, Vanna is worth a look. It’s an MIT-licensed, open-source Python framework that uses Retrieval-Augmented Generation (RAG) to turn plain language into accurate SQL, and yes, you don’t have to understand all the math behind it to use it.
Here’s how it actually works, simply: you train a RAG model on your data (this stores table info, DDL, some business terms, even sample queries if you have them), then you ask questions. The system returns SQL queries that can be set to run automatically against your database. I tested a small table myself, and within minutes I had human-readable SQL snippets I could tweak and run. Messy, real-world data usually needs a little prompting love, but it’s faster than starting from scratch.
Vanna connects to any database, any LLM, and any vector database in practice (there’s a VannaBase class you can extend). Out of the box it includes implementations for OpenAI and ChromaDB, with documentation and a Colab notebook if you want a quick demo. You’ll also find optional packages for extra features, and the docs explain when you might need to rerun training commands.
If you’ve got existing SQL lying around, paste it into the training set. If you want clean business definitions, add those too. The more context you give, the more accurate the generated SQL will be.
Curious? Explore the code and docs here: https://github.com/vanna-ai/vanna
Final thought, and I mean this: tools like Vanna aren’t magic, they’re useful scaffolding. They help you move faster, reduce annoying manual querying, and let you focus on insights, not syntax. The future is likely more of this—practical, open, and customizable.
—
Mit Datenbanken sprechen, ohne SQL-Experte zu sein
Vanna ist ein Open-Source-Python-Framework unter MIT-Lizenz, das Text-zu-SQL mit Hilfe von RAG (Retrieval-Augmented Generation) ermöglicht. Kurz gesagt, du trainierst ein Modell auf deinen Daten (Tabellenstruktur, DDL, Business-Begriffe, sogar vorhandene SQL-Abfragen), und dann stellst du Fragen in natürlicher Sprache. Vanna antwortet mit SQL-Abfragen, die du direkt gegen deine Datenbank laufen lassen kannst.
Ich habe es kurz ausprobiert, mit einer kleinen Beispieltabelle. Binnen weniger Minuten hatte ich brauchbare SQL-Vorschläge, die ich nur leicht anpassen musste. Klar, bei echten, unordentlichen Daten braucht es manchmal noch ein paar Hinweise von dir, aber das ist menschlicher Feinschliff, keine Raketenwissenschaft.
Technisch ist Vanna flexibel, es gibt eine VannaBase-Klasse, die das Grundverhalten definiert. Standard-Implementierungen für OpenAI und ChromaDB sind bereits vorhanden, du kannst aber jede andere LLM- oder Vektor-DB anbinden. In der Dokumentation und im Colab-Notebook findest du schnelle Beispiele und Anleitungen. Optional-Pakete erweitern Funktionen, je nach Bedarf.
Praktischer Tipp: kopiere vorhandene SQL-Abfragen in dein Trainingsset, und füge Geschäftsterminologie hinzu. Das verbessert die Genauigkeit deutlich. Und wenn du neugierig bist, hier ist der Link zum Projekt: https://github.com/vanna-ai/vanna
Kurz: Vanna ist kein Allheilmittel, aber ein sehr nützliches Werkzeug, wenn du schneller zu Antworten aus deinen Daten kommen willst, ohne dich durch endlose SQL-Schleifen zu kämpfen.



Kommentar abschicken