{"id":26782053,"url":"https://github.com/suniljeurkar/panda_sql","last_synced_at":"2025-10-29T00:32:28.387Z","repository":{"id":282170523,"uuid":"947704194","full_name":"suniljeurkar/panda_sql","owner":"suniljeurkar","description":"CSV to MySQL Importer 🛠️   This Python script automates the process of importing a CSV file into a MySQL database by dynamically detecting column names, creating the table, and inserting data while handling missing values (`NULL`). It eliminates the need for manual SQL queries, making data migration seamless and efficient. 🚀","archived":false,"fork":false,"pushed_at":"2025-03-13T05:53:01.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-23T13:30:51.044Z","etag":null,"topics":["csv","migration","sql"],"latest_commit_sha":null,"homepage":"","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/suniljeurkar.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}},"created_at":"2025-03-13T05:42:01.000Z","updated_at":"2025-03-13T05:53:04.000Z","dependencies_parsed_at":"2025-03-13T06:39:26.116Z","dependency_job_id":null,"html_url":"https://github.com/suniljeurkar/panda_sql","commit_stats":null,"previous_names":["suniljeurkar/panda_sql"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/suniljeurkar/panda_sql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suniljeurkar%2Fpanda_sql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suniljeurkar%2Fpanda_sql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suniljeurkar%2Fpanda_sql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suniljeurkar%2Fpanda_sql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/suniljeurkar","download_url":"https://codeload.github.com/suniljeurkar/panda_sql/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suniljeurkar%2Fpanda_sql/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269748149,"owners_count":24469106,"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","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"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":["csv","migration","sql"],"created_at":"2025-03-29T08:19:24.514Z","updated_at":"2025-10-29T00:32:23.354Z","avatar_url":"https://github.com/suniljeurkar.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"### 📄 **README.md**\n```markdown\n# 🛠 CSV to MySQL Importer\n\nThis Python script **automates the process of importing a CSV file into a MySQL database**. \nIt dynamically:\n- Reads the CSV structure\n- Creates the MySQL table based on the columns\n- Inserts the data while handling `NULL` values correctly\n\n---\n\n## 🚀 Features\n- Automated Table Creation: Dynamically detects column names and data types.\n- Handles Missing Data: Converts `NaN` values from CSV to `NULL` in MySQL.\n- Optimized Bulk Insert: Uses batch processing for faster performance.\n- Minimal Configuration: No need to write SQL queries manually.\n\n---\n\n## 🔧 Setup Instructions\n\n### 1️⃣ **Install Dependencies**\nEnsure Python and MySQL are installed, then install the required libraries:\n```sh\npip install mysql-connector-python pandas\n```\n\n### 2️⃣ Setup MySQL Database\nCreate a database in MySQL:\n```sql\nCREATE DATABASE northwind_mysql;\n```\n\n### 3️⃣ Configure MySQL Connection\nModify the `conn` settings in the script if needed:\n```python\nconn = mysql.connector.connect(\n    host=\"localhost\",\n    user=\"root\",\n    password=\"\",  # Change if necessary\n    database=\"northwind_mysql\"\n)\n```\n\n### 4️⃣ Run the Script\nTo execute the script:\n```sh\npython insert_SQL_data.py\n```\n\n---\n\n## 📂 File Structure\n```\n📂 CSV_to_MySQL\n│── customers.csv          # CSV File to import\n│── insert_SQL_data.py     # Python script for importing\n│── sql_create_columns.py  # Python script for creating columns\n│── README.md              # Documentation\n```\n\n---\n\n## 📝 Usage Guide\n\n1️⃣ **Place the CSV file (`customers.csv`) in the script directory.**  \n2️⃣ **Run the script** to automatically create the table and import data.  \n3️⃣ **Verify the data** in MySQL:\n```sql\nSELECT * FROM Customers LIMIT 5;\n```\n\n---\n\n## ❌ Troubleshooting\n\n| Issue | Solution |\n|--------|---------|\n| `Unknown column 'nan' in 'field list'` | Ensure `NaN` values are handled (already fixed in the script). |\n| `Access denied for user 'root'` | Check MySQL credentials in `conn`. |\n| `Table already exists` | Drop existing table or modify script. |\n\n---\n\n## 📌 Future Improvements\n- ✅ Batch insert for performance optimization\n- ✅ Support for multiple CSV imports\n- ✅ Flask API for remote CSV upload \u0026 database insertion\n\n---\n\n## 📜 License\nThis project is open-source and free to use.\n\n---\n\n💡 **Contributions \u0026 feedback are welcome!** Submit a pull request or open an issue. 🚀\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuniljeurkar%2Fpanda_sql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuniljeurkar%2Fpanda_sql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuniljeurkar%2Fpanda_sql/lists"}