SunShot - Sunmetrix Python Bulk Insert Into MySQL

Register
Submit a solution
The challenge is finished.

Challenge Overview

Challenge Overview

The goal of this challenge is to produce a python script to import csv data into mysql database.

Challenge Requirements

  • Client is using MySQL (v 5.5.40) and tables are based on MyISAM storage engine.

  • Write a python script with following requirements :

    • Input is csv file.

      • The filename (without extension) represents the database table name.

      • The csv first row will contains the table column names.

    • Build a generic function that parse the csv and insert data as bulk into database.

    • Add some useful logging for the script execution information.

  • Provided in the challenge forums a script that insert data via for loop. This is the solution we don’t want to see as it is very slow. Your solution should address uploading 10k records in few seconds.

  • We do not want to dictate what solution you should use, we are open to your creativity.

  • The script should use Python version 2.7.3 running on Ubuntu 12.04.2 LTS

Documents

Provided in challenge forums :

  • Table structure.

  • Sample csv file.

  • Existing python insert script.

Deliverable

  • All source code files and scripts that addresses the challenge requirement.

  • Detailed readme file as clarified above.



Final Submission Guidelines

.

Review style

Final Review

Community Review Board

Approval

User Sign-Off

Challenge links

ID: 30049835