How aditya2310-dyp/text-to-sql works
This is a Streamlit text-to-SQL assistant that asks for clarification when a question is ambiguous, then generates, validates, executes, and explains a query. Users can also upload tabular files, which are converted to SQLite; inferred relationships enrich the schema for querying across tables. The graph and UI hand off clarification across turns. The SQL-node implementations were not sampled, so their detailed internals are omitted; those stages and upload capabilities are included based on the README.
Main entry points: graph.py Workflow orchestration · app.py Streamlit app · chinookdb.sqlite Active SQLite data · schema_utils.py Schema extraction
Components 14
User interface
- Streamlit app
app.py - Clarification state
app.py
Data preparation
- File ingestion
ingest.py - Relationship inference
relationship_inference.py - Active SQLite data
chinookdb.sqlite
Query workflow
- Workflow orchestration
graph.py - Ambiguity detection
nodes.py - SQL generation
nodes.py - SQL validation
nodes.py - SQL execution
nodes.py - Result explanation
nodes.py
Shared context
- Schema extraction
schema_utils.py - Graph state
state.py
Other components
- User
Connections 21
- User → Streamlit app: asks question
README.md - Streamlit app → Workflow orchestration: invokes
app.py - Streamlit app → Schema extraction: loads schema
app.py - Streamlit app → Clarification state: tracks replies
app.py - Clarification state → Workflow orchestration: resubmits context
app.py - User → File ingestion: uploads files
README.md - File ingestion → Active SQLite data: creates SQLite
ingest.py - Relationship inference → Active SQLite data: inspects tables
relationship_inference.py - Relationship inference → SQL generation: enriches schema
README.md - Workflow orchestration → Ambiguity detection: routes
graph.py - Workflow orchestration → SQL generation: routes
graph.py - Workflow orchestration → SQL validation: routes
graph.py - Workflow orchestration → SQL execution: routes
graph.py - Workflow orchestration → Result explanation: routes
graph.py - Workflow orchestration → Graph state: uses state
graph.py - Schema extraction → Ambiguity detection: supplies schema
README.md - Schema extraction → SQL generation: supplies schema
README.md - SQL validation → Active SQLite data: dry-runs query
README.md - SQL execution → Active SQLite data: runs query
README.md - Workflow orchestration → Streamlit app: returns result
app.py - Streamlit app → User: shows answer
app.py