如何在 mysqlsh importTable util 中设置 IGNORE 标志?
How to set the IGNORE flag in mysqlsh importTable util?
以下触发 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.
以下触发 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.