Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/anzo52/csv2mysql
Export data from a csv file into a mysql database
https://github.com/anzo52/csv2mysql
converter csv csv-to-database csv-to-mysql csv-to-sql csv2mysql mysql pandas
Last synced: 4 days ago
JSON representation
Export data from a csv file into a mysql database
- Host: GitHub
- URL: https://github.com/anzo52/csv2mysql
- Owner: Anzo52
- License: gpl-3.0
- Created: 2023-11-01T22:30:39.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-02T02:22:38.000Z (about 1 year ago)
- Last Synced: 2024-11-08T18:21:11.875Z (about 2 months ago)
- Topics: converter, csv, csv-to-database, csv-to-mysql, csv-to-sql, csv2mysql, mysql, pandas
- Language: Python
- Homepage:
- Size: 21.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
csv2mysql
[![Status](https://img.shields.io/badge/status-active-success.svg)]()
[![GitHub Issues](https://img.shields.io/github/issues/Anzo52/csv2mysql.svg)](https://github.com/kylelobo/The-Documentation-Compendium/issues)
[![GitHub Pull Requests](https://img.shields.io/github/issues-pr/Anzo52/csv2mysql.svg)](https://github.com/Anzo52/csv2mysql/pulls)
[![License](https://img.shields.io/badge/license-GPL3-blue.svg)](/LICENSE)---
Python script to convert csv files to mysql database tables.
## 📝 Table of Contents
- [About](#about)
- [Getting Started](#getting_started)
- [Usage](#usage)
- [Built Using](#built_using)This project is a python script to convert csv files to mysql database tables. Only tested on Linux, LMDE 5, Debian 10.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See [deployment](#deployment) for notes on how to deploy the project on a live system.
### Prerequisites
As stated in [Getting Started](#getting_started), this project was only tested on Linux, LMDE 5, Debian 10, so built-in tools may not be available on other systems. Please create an issue if you have any problems.
Other than that, you'll need to install the following dependencies (you'll find step-by-step instructions for the Python packages in the [Installing](#installing) section below):
- Python 3.7 or higher
- pip (Python package manager) <-- I used debian's package manager to install this
- Python packages:
- sqlalchemy
- pandas
- numpy
- MySQL server (version 8.0.23) <-- I used debian's package manager to install this
- MySQL Workbench (version 8.0.23) <-- I used debian's package manager to install thisIt is recommended to use a virtual environment to install the dependencies. The following instructions will install the dependencies in a virtual environment.
You should also have a MySQL server running on your machine. You can download it from [here](https://dev.mysql.com/downloads/mysql/). Instructions for setting up a MySQL server can be found [here](https://dev.mysql.com/doc/mysql-getting-started/en/).Here's a list of the installation steps required to get the project up and running, it's assumed that you already have Python 3.7 or higher, pip, and venv installed. If you don't, please refer to the [Prerequisites](#prerequisites) section above or the [Python documentation](https://www.python.org/about/gettingstarted/):
1. Clone the repository and cd into the project directory
2. Create and activate a virtual environment
3. Install the dependencies
4. Create a MySQL database
5. Run the script1. Clone the repository and cd into the project directory
```bash
git clone https://github.com/Anzo52/csv2mysql.git
cd csv2mysql
```2. Create and activate a virtual environment
```bash
python3 -m venv venv
source venv/bin/activate
```3. Install the dependencies
```bash
pip install -r requirements.txt
```4. Create a MySQL database
```bash
mysql -u root -p
```
```sql
CREATE DATABASE [database_name];
```5. Run the script (you'll be prompted to enter the database name, username, and password. Make sure to use the same database name you used in step 4)
```bash
python3 csv2mysql.py
```- [Python](https://www.python.org/) - Programming language
- [pandas](https://pandas.pydata.org/) - Data analysis and manipulation tool
- [numpy](https://numpy.org/) - Scientific computing package
- [sqlalchemy](https://www.sqlalchemy.org/) - SQL toolkit and Object Relational Mapper