gpt4 book ai didi

mysql - Sqoop 导入 : Specify `select` expressions in a separate file?

转载 作者:可可西里 更新时间:2023-11-01 15:15:52 26 4
gpt4 key购买 nike

将数据从 MySQL 导入 Hive 时,我需要规范化几个包含电话号码的文本字段。这需要相当复杂的逻辑,很难用单个 SQL replace 函数在 Sqoop 命令行中表达。是否可以在单独的文件中指定 SQL select 表达式并从命令行引用它?

谢谢!

最佳答案

你可以试试:

$ sqoop --options-file /users/homer/work/option.txt -

您的 option.txt 将如下所示:

# Options file for Sqoop import
#

# Specifies the tool being invoked
import

# Connect parameter and value
--connect
jdbc:mysql://localhost/db

# Username parameter and value
--username
foo

## Query
--query
"select * from Table WHERE \$CONDITIONS"

关于mysql - Sqoop 导入 : Specify `select` expressions in a separate file?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22479577/

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