【问题标题】:Multiple character delimiter using apache sqoop import使用 apache sqoop 导入的多字符分隔符
【发布时间】:2016-12-27 13:43:35
【问题描述】:

我正在使用 apache sqoop 将数据从 teradata(RDBMS) 导入配置单元。用于导入的常用分隔符(如 ",", "|", "~")出现在表中。有没有办法在 apache sqoop 中使用多个字符作为分隔符。

为了避免这种情况,我在 sqoop 导入命令中使用了--escaped-by "\t"--fields-terminated-by "," 参数。那么有没有办法“取消转义”我在 sqoop 导入中使用的"\t"

【问题讨论】:

  • 您在从 teradata 导入或将数据从 hive 导出到 tera 数据时遇到问题..
  • --escaped-by \\ --enclosed-by '\"'
  • 是否有您想要的特定格式..因为这是转义字符。如果有您喜欢的任何要求。

标签: hive sqoop


【解决方案1】:

每当我遇到具有挑战性的表时,我都会使用“\b”分隔符,这些表包含的大数据字段包含可能包含 TABS 和 CR/LF 字符的文本。 '\b' 相当于 BACKSPACE,在大多数数据库中很难插入到字符域中。

这是我使用的 sqoop 命令的示例:

            sqoop import 
              --connect "jdbc:sqlserver://myserver;DatabaseName=MyDB;user=MyUser;password=MyPassword;port=1433"
              --warehouse-dir=/user/MyUser/Import/MyDB 
              --fields-terminated-by '\b' --num-mappers 8
              --table training_deficiency 
              --hive-table stage.training_deficiency 
              --hive-import --hive-overwrite
              --hive-delims-replacement '<newline>' 
              --split-by Training_Deficiency_ID 
              --outdir /home/MyUser/sqoop/java
              --where "batch_update_dt > '2016-12-09 23:06:44.69'"

【讨论】:

    猜你喜欢
    • 2018-05-28
    • 1970-01-01
    • 1970-01-01
    • 2016-11-16
    • 2013-10-16
    • 1970-01-01
    • 1970-01-01
    • 2017-03-10
    • 2021-05-15
    相关资源
    最近更新 更多