How sam-garg/sql_text_app works
This is a Streamlit CSV-to-SQL analysis app. A user uploads a CSV, the app parses and previews it, stores it in a temporary SQLite database, then uses the database schema and a natural-language question to generate SQL with an Ollama-backed LangChain pipeline. The app executes the SQL and displays the query and results. The graph reflects the sampled app.py workflow; create_db.py appears to be a separate sample-database utility, not part of the documented dynamic workflow.
Main entry points: app.py Question Handling
Components 15
User Interface
- Streamlit Interface
app.py - Results Display
app.py
Data Preparation
- CSV Parsing
app.py - Data Preview
app.py - Temporary SQLite
app.py - SQL Database Adapter
app.py
SQL Analysis
- Question Handling
app.py - Schema Retrieval
app.py - SQL Prompt
app.py - LangChain Pipeline
app.py - ChatOllama Model
app.py - SQL Output Parser
app.py - SQL Execution
app.py
Other components
- Analyst
- Ollama Service
Connections 17
- Analyst → Streamlit Interface: uploads CSV
app.py - Streamlit Interface → CSV Parsing: passes file
app.py - CSV Parsing → Data Preview: provides rows
app.py - CSV Parsing → Temporary SQLite: writes table
app.py - Temporary SQLite → SQL Database Adapter: opens database
app.py - Streamlit Interface → Question Handling: accepts question
app.py - Question Handling → Schema Retrieval: reads schema
app.py - Schema Retrieval → SQL Database Adapter: requests table info
app.py - Question Handling → LangChain Pipeline: invokes pipeline
app.py - LangChain Pipeline → SQL Prompt: formats input
app.py - SQL Prompt → ChatOllama Model: supplies prompt
app.py - ChatOllama Model → Ollama Service: requests completion
app.py - ChatOllama Model → SQL Output Parser: returns model output
app.py - Question Handling → SQL Execution: runs generated SQL
app.py - SQL Execution → SQL Database Adapter: executes query
app.py - SQL Execution → Results Display: displays result
app.py - Question Handling → Results Display: shows generated SQL
app.py