gpt4 book ai didi

mysql - 如何在 mysqlsh importTable util 中设置 IGNORE 标志?

转载 作者:行者123 更新时间:2023-11-29 09:31:59 25 4
gpt4 key购买 nike

以下内容会触发 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com