I try to import data into a mySQL database using Python, but I can't get it to work. I don't get any errors it looks as if everything is working OK, but the text file never gets imported.
I can import the text file just fine if I do it manually via the mysql command line in Terminal. What am I doing wrong?
imoprt mysql.connector
cnx = mysql.connector.connect(user ='user1', password ='12345', host ='127.0.0.1', database ='stockStatus')
cursor = cnx.cursor()
cursor.execute('use stockStatus')
cursor.execute('truncate table products')
cursor.execute("LOAD DATA INFILE '/Path/products.txt' INTO TABLE products IGNORE 1 LINES")
cnx.close()