How sainitesh10/ai-sql-assistant works
AI SQL Assistant is a browser-based analytics app: users upload a CSV, ask a question in natural language, and receive SQL results and an optional chart. The React app coordinates CSV loading, Gemini requests, local SQLite execution, result display, and CSV export. README-documented capabilities include client-side CSV parsing, WebAssembly SQLite, AI chart recommendations, and chart rendering. The excerpts show the main calls; unsampled UI details are represented within the App component rather than inferred as separate modules.
Main entry points: App.jsx App workflow · database.js In-memory SQLite · gemini.js SQL generation · main.jsx React entry
Components 13
User interface
- App workflow
src/App.jsx - Results and CSV export
src/App.jsx - Chart rendering
src/App.jsx - React entry
src/main.jsx
AI analytics
- SQL generation
src/utils/gemini.js - Chart recommendation
src/utils/gemini.js
Browser data
- CSV ingestion
src/utils/database.js - In-memory SQLite
src/utils/database.js - SQL execution
src/utils/database.js
Other components
- User
- Gemini API
- PapaParse
- sql.js WebAssembly
Connections 15
- User → App workflow: uploads and asks
src/App.jsx - React entry → App workflow: renders
src/main.jsx - App workflow → In-memory SQLite: initializes
src/App.jsx - App workflow → CSV ingestion: loads CSV
src/App.jsx - CSV ingestion → PapaParse: parses CSV
src/utils/database.js - CSV ingestion → In-memory SQLite: creates table
src/utils/database.js - In-memory SQLite → sql.js WebAssembly: initializes engine
src/utils/database.js - App workflow → SQL generation: requests SQL
src/App.jsx - SQL generation → Gemini API: generates SQL
src/utils/gemini.js - App workflow → SQL execution: executes SQL
src/App.jsx - SQL execution → In-memory SQLite: runs query
src/utils/database.js - App workflow → Chart recommendation: requests chart type
src/App.jsx - Chart recommendation → Gemini API: analyzes results
src/utils/gemini.js - App workflow → Results and CSV export: displays and exports
src/App.jsx - App workflow → Chart rendering: renders visualization
src/App.jsx