Python3 cursor.execute 语法正确
Python3 cursor.execute correct syntax
尝试使用 python3 和本地 csv 文件插入一些数据 - 此语法有什么问题? python 一直在说
mysql.connector.errors.ProgrammingError: 1064 (42000): You have an
error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near ' FIELDS
TERMINATED BY ','' at line 1
cursor.execute("""LOAD DATA LOCAL INFILE '/home/user/mongo_exported_users.csv' INTO TABLE users IGNORE 1 LINES, FIELDS TERMINATED BY ','""")
根据documentation,FIELDS TERMINATED BY
子句前不能有逗号,而且IGNORE # LINES
子句必须在FIELDS TERMINATED BY
子句之后:
cursor.execute("""LOAD DATA LOCAL INFILE '/home/user/mongo_exported_users.csv'
INTO TABLE users FIELDS TERMINATED BY ',' IGNORE 1 LINES""")
尝试使用 python3 和本地 csv 文件插入一些数据 - 此语法有什么问题? python 一直在说
mysql.connector.errors.ProgrammingError: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' FIELDS TERMINATED BY ','' at line 1
cursor.execute("""LOAD DATA LOCAL INFILE '/home/user/mongo_exported_users.csv' INTO TABLE users IGNORE 1 LINES, FIELDS TERMINATED BY ','""")
根据documentation,FIELDS TERMINATED BY
子句前不能有逗号,而且IGNORE # LINES
子句必须在FIELDS TERMINATED BY
子句之后:
cursor.execute("""LOAD DATA LOCAL INFILE '/home/user/mongo_exported_users.csv'
INTO TABLE users FIELDS TERMINATED BY ',' IGNORE 1 LINES""")