Forums

Programmatically LOAD DATA INFILE

Is there a way to have a script to LOAD DATA INFILE?

Hi- checkout how to do a restore on our help pages.

The link points to a DB restore. I was asking about a LOAD DATA LOCAL INFILE.

Oh sorry, I thought you wanted to load the file to restore the DB. Perhaps check out this forum discussion?

hmm... looks like we can specify the proper option in the connection statement. Haven't had the opportunity to test (had used a workaround for the task that had prompted me to ask this question) but worth giving it a try. (works locally)

db=MySQLdb.connect(passwd="pw",db="user$trackshunter",host='user.mysql.pythonanywhere-services.com',local_infile=1)