How definitive-io/duckdb-text2sql works
DuckDB Query Generator is a Streamlit question-to-SQL app: a user asks about CSV-backed data, Groq generates DuckDB SQL, the app parses and executes it, and Groq summarizes results. The workflow and customization, correction, and summarization stages are visible in app.py; the base prompt and CSV inputs are documented. The excerpts do not establish the prompt’s exact contents or explicit file-reading behavior inside DuckDB, so those data links are documented rather than inferred from implementation.
Main entry points: app.py Streamlit workflow · employees.csv Employee CSV · purchases.csv Purchase CSV · base_prompt.txt Base prompt
Components 14
App workflow
- Streamlit workflow
app.py - Model and context options
app.py - Result summarization
app.py
AI generation
- Base prompt
prompts/base_prompt.txt - Groq API
- Response parsing
app.py - SQL correction
app.py
Query execution
- Generated SQL
app.py - DuckDB executor
app.py - In-memory DuckDB
app.py - Query results
app.py
Data and prompts
- Employee CSV
data/employees.csv - Purchase CSV
data/purchases.csv
Other components
- Question asker
Connections 17
- Question asker → Streamlit workflow: asks question
app.py - Streamlit workflow → Model and context options: configures
app.py - Streamlit workflow → Base prompt: loads
app.py - Streamlit workflow → Groq API: requests SQL
app.py - Streamlit workflow → Response parsing: parses reply
app.py - Response parsing → Generated SQL: extracts SQL
app.py - Streamlit workflow → DuckDB executor: executes query
app.py - DuckDB executor → In-memory DuckDB: runs SQL
app.py - Streamlit workflow → SQL correction: requests correction
app.py - SQL correction → Groq API: sends correction
app.py - DuckDB executor → Query results: returns rows
app.py - Streamlit workflow → Result summarization: summarizes results
app.py - Result summarization → Groq API: requests summary
app.py - Result summarization → Query results: uses rows
app.py - Streamlit workflow → Question asker: displays answer
app.py - Employee CSV → In-memory DuckDB: queried as data
README.md - Purchase CSV → In-memory DuckDB: queried as data
README.md