1

I have .sql file which has multiple load commands as follows,

LOAD DATA LOCAL INFILE 'csvname.csv' INTO TABLE table_name FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 LINES(....);
LOAD DATA LOCAL INFILE 'csvname.csv' INTO TABLE table_name FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 LINES(....);

Which runs perfectly in SQL terminal but in the script I don't get any error still not loading

My code:

#db = pymysql.connect(**db_opts)
conn = pymysql.connect(rds_host, user=name, passwd=password, db=db_name, connect_timeout=5,local_infile=True)
cur = conn.cursor()
print ("Connected!\n")
for line in open('load.sql','r'):
    print(line)
    cur.execute(line)
conn.close()

Can anyone help?

1 Answer 1

1

Pymysql doesnot support load command.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.