【问题标题】:MLCP ingestion of multi character "~|^" delimitted file into Marklogic将多字符“~|^”分隔文件的 MLCP 摄取到 Marklogic 中
【发布时间】:2019-01-16 21:39:52
【问题描述】:

我有一个分隔符为 ~|^ 的分隔文本文件。 我需要使用 MLCP 将此文件摄取到 marklogic 中。为此,我尝试使用 2 种方式摄取 MLCP。

  1. 使用不带选项文件的 MLCP

    mlcp.sh import -username admin -password admin -input_file_type delimited_text -delimiter "~|^" -document_type json -host localhost -database test -port 8052 -output_uri_prefix /test/data/ -generate_uri -output_uri_suffix .json \-output_collections "Test" -input_file_path inputfile1.csv

  2. 通过选项文件使用 MLCP

    mlcp.sh import -username admin -password admin -options_file delim.opt -document_type json -host localhost -database test -port 8052 -output_uri_prefix /test/data/ -generate_uri -output_uri_suffix .json \-output_collections "Test" -input_file_path inputfile1.csv

我的选项文件如下所示(delim.opt):

-input_file_type
delimited_text
-delimiter
"~|^"

但是在这两种方式中,mlcp 都不起作用,我收到以下错误:

java.lang.IllegalArgumentException:无效的分隔符:~|^

谁能帮助我了解如何通过 MLCP 将这些类型的 CSV 文件摄取到 MarkLogic 中?

【问题讨论】:

    标签: nosql marklogic delimiter mlcp data-ingestion


    【解决方案1】:

    我相信 MarkLogic 内容泵不支持解析多字符分隔符。 MarkLogic content pump 使用 Apache Commons CSV library 解析分隔文本。到今天为止,解析多字符分隔符的分隔文本似乎存在一个未解决的问题,请参阅问题 CSV-206

    现在您可以使用单字符分隔符创建新的分隔文本文件。我经常在命令行中使用sed 来替换文件中的字符串。如果您走这条路线,请注意您需要转义记录值中出现的任何新分隔符。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多