I am attempting to execute a MySQL LOAD DATA LOCAL statement using Python. Below is the statement in MySQL which works as expected, i.e. data in file.csv is populated in MyTable.
LOAD DATA LOCAL INFILE '/home/user/Downloads/file.csv'
INTO TABLE MyDB.MyTable
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
When attempting to replicate this with the below I do not receive any errors but the table is not populated.
sql_statement = """LOAD DATA LOCAL INFILE '/home/user/Downloads/file.csv'
INTO TABLE MyDB.MyTable
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'"""
cursor.execute(sql_statement, multi=True)
connection.commit()
Anybody notice where I may be going wrong?
LOAD DATA LOCAL INFILE '/home/user/Downloads/file.csv'
INTO TABLE MyDB.MyTable
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
When attempting to replicate this with the below I do not receive any errors but the table is not populated.
sql_statement = """LOAD DATA LOCAL INFILE '/home/user/Downloads/file.csv'
INTO TABLE MyDB.MyTable
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'"""
cursor.execute(sql_statement, multi=True)
connection.commit()
Anybody notice where I may be going wrong?