【发布时间】:2017-03-22 20:56:13
【问题描述】:
我正在使用以下命令进行 sqoop 导入:
#!/bin/bash
while IFS=":" read -r server dbname table; do
sqoop eval --connect jdbc:mysql://$server/$dbname --username root --password cloudera --table mydata --hive-import --hive-table dynpart --check-column id --last-value $(hive -e "select max(id) from dynpart"); --hive-partition-key 'thisday' --hive-partition-value '01-01-2016'
done<tables.txt
我每天都在做分区。 蜂巢表:
create table dynpart(id int, name char(30), city char(30))
partitioned by(thisday char(10))
row format delimited
fields terminated by ','
stored as textfile
location '/hive/mytables'
tblproperties("comment"="partition column: thisday structure is dd-mm-yyyy");
但我不想直接给出分区值,因为我想创建一个 sqoop 作业并每天运行它。在脚本中,如何将日期值动态传递给 sqoop 命令(格式:dd/mm/yyyy)而不是直接提供? 任何帮助表示赞赏。
【问题讨论】:
-
YYYY-MM-DD (!!)
-
嗯,我得到了所需格式的日期。我在表中有 3 列中的数据。问题是,表中的实际数据为 NULL,如下所示 NULL NULL NULL 30-03-2017