This project demonstrates how to bulk upload data from a CSV file to a MySQL database using Python and the Pandas library. The data is uploaded into a table called Product in the MySQL database ecommerce.
- Connect to a MySQL database.
- Create a table named
Productwith fields:name,description,price,image_url. - Read product data from a CSV file.
- Bulk upload the CSV data into the MySQL database.
Before running the project, ensure you have the following installed:
- Python 3.x
- MySQL server
- Pandas library (
pip install pandas) - MySQL Connector for Python (
pip install mysql-connector-python)
bulkUpload.py: Python script to handle database connection, table creation, and bulk file upload.product.csv: Sample dataset with 30 products, including fieldsname,description,price, andimage_url.
- Install the required libraries:
pip install pandas mysql-connector-python
- Update the MySQL database credentials in the
db_connect()function inside thebulkUpload.pyfile. - Place your CSV file at the specified path.
- Run the Python script:
python bulkUpload.py
Below is the screenshot of the Product table before data is uploaded:
Below is the screenshot of the Product table after the bulk upload is completed:

