以下内容会触发 mysql8
中的 LOAD DATA INFILE
语句:
util.importTable("sample.csv", {schema: "myschema", table: "mytable", dialect: "csv-unix", fieldsTerminatedBy: ";", showProgress: true})
问题:如何添加 IGNORE INTO
标志?
最佳答案
util.importTable
使用LOAD DATA LOCAL INFILE
并默认忽略重复键[1]。如果您想替换重复键,请将 replaceDuplicates
选项设置为 true
。
[1] MySQL Reference Manual for LOAD DATA Syntax
Duplicate-Key Handling
(…) With LOCAL, the default behavior is the same as if IGNORE is specified; this is because the server has no way to stop transmission of the file in the middle of the operation.
关于mysql - 如何在 mysqlsh importTable util 中设置 IGNORE 标志?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58518207/