{"id":51469546,"url":"https://github.com/iamvikash28/nl2sql","last_synced_at":"2026-07-06T15:30:51.846Z","repository":{"id":369536974,"uuid":"1290263883","full_name":"iamvikash28/nl2sql","owner":"iamvikash28","description":"Ask your database questions in plain English. Get back real SQL, a safety check, and a results table.","archived":false,"fork":false,"pushed_at":"2026-07-05T19:49:58.000Z","size":36,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-07-05T21:04:55.956Z","etag":null,"topics":["chatbot","data-analysis","database","gemini","gemini-api","google-genai","llm","llm-apps","nl2sql","nlp","pandas","python","sql","sql-generator","sqlite","streamlit","text-to-sql"],"latest_commit_sha":null,"homepage":"https://nl-2sql.streamlit.app/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iamvikash28.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-07-05T19:01:28.000Z","updated_at":"2026-07-05T19:50:01.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/iamvikash28/nl2sql","commit_stats":null,"previous_names":["iamvikash28/nl2sql"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/iamvikash28/nl2sql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamvikash28%2Fnl2sql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamvikash28%2Fnl2sql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamvikash28%2Fnl2sql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamvikash28%2Fnl2sql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iamvikash28","download_url":"https://codeload.github.com/iamvikash28/nl2sql/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamvikash28%2Fnl2sql/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35197534,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-06T02:00:07.184Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatbot","data-analysis","database","gemini","gemini-api","google-genai","llm","llm-apps","nl2sql","nlp","pandas","python","sql","sql-generator","sqlite","streamlit","text-to-sql"],"created_at":"2026-07-06T15:30:51.078Z","updated_at":"2026-07-06T15:30:51.843Z","avatar_url":"https://github.com/iamvikash28.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Natural Language to SQL Chatbot\n\nNL2SQL Chatbot lets anyone query a database by just asking a question — no SQL knowledge needed. Behind the scenes, Gemini generates the query grounded in the real database schema, and a safety layer blocks anything that isn't a read-only SELECT before it can touch the data. Built with Streamlit, SQLite, and the Gemini API.\n\n\n---\n\n## Project files\n\n```\nnl2sql-chatbot/\n├── create_database.py   # generates the sample SQLite database (shop.db)\n├── utils.py              # schema reader + SQL safety guard\n├── nl_to_sql.py           # prompt engineering + Gemini API call\n├── app.py                 # Streamlit chat UI (the actual app)\n├── requirements.txt\n└── README.md\n```\n\n## Setup\n\n**Step 1 — Install dependencies**\n```bash\npip install -r requirements.txt\n```\n\n**Step 2 — Get a free Gemini API key**\nGo to https://aistudio.google.com/apikey, sign in with a Google account,\nand click \"Create API key\". It's free for moderate usage.\n\n**Step 3 — Build the sample database**\n```bash\npython create_database.py\n```\nThis creates `shop.db` with three tables: `customers`, `products`, `orders`\n(60 customers, 48 products, 800 orders — realistic enough to ask interesting\nquestions).\n\n**Step 4 — Run the app**\n```bash\nstreamlit run app.py\n```\nYour browser opens automatically. Paste your Gemini API key into the\nsidebar, and start asking questions like:\n- \"Show top 10 customers by revenue\"\n- \"Which product category sells the most?\"\n- \"Total sales by city\"\n- \"How many orders were placed in 2024?\"\n\n---\n\n## Skills\n\n| SQL | Reading/writing SELECT, JOIN, GROUP BY, aggregate functions |\n| Prompt engineering | `nl_to_sql.py` — schema grounding, output constraints |\n| Database querying | `sqlite3`, `pandas.read_sql_query()` |\n| AI integration | Calling the Gemini API via `google-genai` SDK |\n| App security | Validating untrusted LLM output before executing it |\n| Streamlit | Chat UI, session state, sidebar, dataframes |\n\n## Live demo\n[nl-2sql.streamlit.app](https://nl-2sql.streamlit.app)\n\n## 👤 Author\n\n**Vikash Verma**\nAspiring Data Analyst | Excel · SQL · Power BI · Python | E-mail- vikashverma566@gmail.com\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamvikash28%2Fnl2sql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiamvikash28%2Fnl2sql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamvikash28%2Fnl2sql/lists"}