<commit_before>import csv
import MySQLdb
import getpass

mydb = MySQLdb.connect(host='sql.mit.edu',
    user='amcdunn',
    passwd=getpass.getpass("Password for sql.mit.edu:"),
    db='amcdunn+LL_dictionary')
cursor = mydb.cursor()
cursor.execute("SELECT * FROM dummy_dictionary")
print(cursor.fetchall())
csv_file = raw_input("Enter path of csv file:")
sql = """LOAD DATA LOCAL INFILE '{}' \
      INTO TABLE dummy_dictionary \
      FIELDS TERMINATED BY ',' \
      OPTIONALLY ENCLOSED BY '"'  \
      LINES TERMINATED BY '\r\n' \
      IGNORE 0 LINES;;"""
try:
    print(sql.format(csv_file))
    cursor.execute(sql.format(csv_file))
    mydb.commit()
except Exception:
    mydb.rollback()
    print("Error adding lines to database")
#close the connection to the database.
mydb.commit()
cursor.close()
print "Done"<commit_msg>changed from LOAD DATA to INSERT<commit_after>import csv
import MySQLdb
import getpass

mydb = MySQLdb.connect(host='sql.mit.edu',
    user='amcdunn',
    passwd=<PASSWORD>.getpass("Password for sql.mit.edu:"),
    db='amcdunn+LL_dictionary')
cursor = mydb.cursor()

csv_data = csv.reader(raw_input("Enter path of csv file:"))
for row in csv_data:
    try:
        cursor.execute('INSERT INTO testcsv(names, \
              classes, mark )' \
              'VALUES("%s", "%s", "%s")', 
              row)
        mydb.commit()
    except Exception:
        mydb.rollback()
        print("Error adding this row to database:\n"+row)

cursor.close()
print "Done"
{'fraction_non_alphanumeric': 0.13911290322580644, 'fraction_numerical': 0.0006720430107526882, 'mean_word_length': 3.3794117647058823, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7341921', 'n_tokens_mistral': 513, 'n_tokens_neox': 485, 'n_words': 120}