How wilson101xx/vannaai-azure-snowflake works
Project type and purpose
• This is a full-stack AI-powered SQL assistant that exposes a FastAPI backend and a Streamlit frontend. It integrates Vanna.AI’s prompt-to-SQL capabilities with Azure AI Search as a vector database, and Snowflake as the data warehouse.
• Purpose: allow users to train on schemas, docs, prompt-SQL pairs and then ask natural-language questions to generate and run SQL, returning results and summaries.
File structure
• Top-level:
• src/api: FastAPI entrypoint (main.py), Pydantic schemas, routers for training and querying
• src/config: environment-variable loader
• src/core: implementation of Azure Search client, custom vector store handler, Snowflake handler, and a “Vanna” orchestrator
• src/services: business-logic helpers (Snowflake queries, training orchestration, Azure calls)
• src/tests: workflow tests
• streamlit-ui: Streamlit app that consumes the API
• Config files: example.env, requirements.txt, .gitignore
• Deployment: uvicorn run command in README
README for additional insights
• Tech stack: FastAPI, Pydantic, Snowflake Python connector, Azure AI Search vector store, Azure OpenAI embeddings, Streamlit
• Features: training endpoints (base data, documents, prompt/SQL, DDL), query endpoints (ask, suggested questions)
• Described custom vector store methods in azure_vectorstore.py (though filename in README differs slightly from file tree azure_custom_db.py)
Elements
• UI → API
• API → Service → Core → External
• External → Core → Service → API → UI
• Frontend: light blue rectangle
• API & Services: blue rectangles
• Core integrations: orange rectangles