This Python script reads CSV file and inserts it into MySQL database. You will need to have your own MYSQL installed on your local machine.
name | surname | |
---|---|---|
Ahmed | Shaaban | ahmed@gmail.com |
It must contain name, surname, and email. There should not be any spaces between the three columns in order for the script to run. Your name and/or surname could be empty but you have to provide an email. Your email should be unique. Otherwise, your data (name, surname, and email) won't be saved.
Before running the script, you would need to install the MySQLdb
package if you don't have it already.
To run this script, type python user_upload.py -u [username] -p [password] --host [hostname]
followed by one of these commands:
--file [csv file name] - This is the name of the CSV to be parsed
--create_table - This will build/rebuild a new table
--dry_run [csv file name] - This runs the script without inserting into the users table