{"id":26086730,"url":"https://github.com/mindscope-world/sql_llm_assistant","last_synced_at":"2025-06-17T00:38:47.096Z","repository":{"id":270247866,"uuid":"909734016","full_name":"mindscope-world/SQL_LLM_Assistant","owner":"mindscope-world","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-29T17:53:59.000Z","size":76,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-09T07:18:10.427Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mindscope-world.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2024-12-29T16:14:11.000Z","updated_at":"2024-12-29T17:54:02.000Z","dependencies_parsed_at":"2024-12-29T18:21:03.978Z","dependency_job_id":"7add1456-d475-4545-b1b1-6630f5fc1faf","html_url":"https://github.com/mindscope-world/SQL_LLM_Assistant","commit_stats":null,"previous_names":["mindscope-world/sql_llm_assistant"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mindscope-world/SQL_LLM_Assistant","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mindscope-world%2FSQL_LLM_Assistant","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mindscope-world%2FSQL_LLM_Assistant/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mindscope-world%2FSQL_LLM_Assistant/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mindscope-world%2FSQL_LLM_Assistant/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mindscope-world","download_url":"https://codeload.github.com/mindscope-world/SQL_LLM_Assistant/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mindscope-world%2FSQL_LLM_Assistant/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260268635,"owners_count":22983601,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2025-03-09T07:18:08.786Z","updated_at":"2025-06-17T00:38:47.072Z","avatar_url":"https://github.com/mindscope-world.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SQL Data Assistant\n\n## Overview\nSQL Data Assistant is a Streamlit-powered application that enables users to upload datasets, ask natural language questions, and receive SQL queries and results as output. This tool is particularly useful for data analysts, developers, and anyone looking to interact with data using SQL without writing queries manually.\n\n## Features\n- Upload CSV or Excel files for processing.\n- Automatically normalize column names for SQL compatibility.\n- Ask natural language questions about your dataset.\n- Generate SQL queries dynamically using OpenAI's GPT-powered assistant.\n- Execute the generated SQL query and display the results.\n- In-memory SQLite database for query execution.\n\n## Requirements\n- Python 3.9 or later\n- Streamlit\n- Pandas\n- Phidata\n- OpenAI API Key\n- SQLite (comes pre-installed with Python)\n\n## Installation\n\n### Step 1: Clone the Repository\n```bash\ngit clone https://github.com/your-repo/sql-data-assistant.git\ncd sql-data-assistant\n```\n\n### Step 2: Create a Virtual Environment\n```bash\npython -m venv venv\nsource venv/bin/activate   # On Windows, use `venv\\Scripts\\activate`\n```\n\n### Step 3: Install Dependencies\n```bash\npip install -r requirements.txt\n```\n\n### Step 4: Set Up OpenAI API Key\nYou need an OpenAI API Key to use the assistant. Obtain one from [OpenAI](https://platform.openai.com/).\n\nStore your key securely, as you'll need to input it into the application.\n\n## Usage\n\n### Step 1: Run the Application\n```bash\nstreamlit run app.py\n```\n\n### Step 2: Interact with the App\n1. **Upload a Dataset**:\n   - Use the sidebar to upload a CSV or Excel file.\n   - The application will display the data and normalize the column names.\n2. **Enter Your Question**:\n   - Ask a natural language question, such as \"What is the highest data_value?\".\n3. **View Results**:\n   - The application will generate an SQL query, execute it, and display the results.\n\n## Example Questions\n- What is the average value in the `Data_value` column?\n- How many rows have `STATUS` equal to 'F'?\n- Show all rows where `Period` is greater than 2018.\n\n## File Structure\n```\nsql-data-assistant/\n├── app.py               # Main Streamlit application\n├── requirements.txt     # Python dependencies\n├── README.md            # Project documentation\n└── sample_data/         # Directory for example datasets (if any)\n```\n\n## Error Handling\n### Common Issues\n1. **Unicode Errors**:\n   - If special characters or emojis cause errors, ensure UTF-8 encoding is used.\n2. **SQL Execution Errors**:\n   - Ensure column names in your dataset match the generated SQL query.\n3. **File Format Errors**:\n   - Only CSV and Excel files are supported.\n\n### Debugging Tips\n- Check the Streamlit logs in the terminal for detailed error messages.\n- Use the normalized column names displayed in the app to ensure compatibility.\n\n## Contributing\nContributions are welcome! Please fork the repository and submit a pull request with your changes.\n\n## License\nThis project is licensed under the MIT License. See the `LICENSE` file for more details.\n\n## Acknowledgments\n- [Streamlit](https://streamlit.io/): For creating an intuitive web framework for Python.\n- [OpenAI](https://openai.com/): For providing the GPT-based assistant.\n- [Pandas](https://pandas.pydata.org/): For data manipulation and analysis.\n\n---\nHappy querying! 🚀\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmindscope-world%2Fsql_llm_assistant","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmindscope-world%2Fsql_llm_assistant","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmindscope-world%2Fsql_llm_assistant/lists"}