sqoop同步时间戳到mysql,Sqoop - 日期 - 时间戳

I am trying to sqoop in the data from Oracle into Hadoop.

In the Oracle side the date field is timestamp with format: '10/01/2015 12:00:00 AM'. How do I just put filter on month, day, and year?

Don't need hours and min in the filter, however the data that gets loaded into HDFS needs to have 10/01/2015 12:00:00 AM' format. Any idea? I looked at other stackoverflow, didn't find it this format. Thanks!!

Please see the code below. I don't get any results.

sqoop import \

--compress \

--target-dir /tmp/inbound/employee \

--query "SELECT EMPLOYEE_ID,NAME,ZIP_CODE,START_DATE FROM TEST_DB_A.EMPLOYEE WHERE EMPLOYEE_ID = '12345' and ACTIVE_EMP = 'YES' and CAST(START_DATE as DATE) = '2015-10-01' and \$CONDITIONS" \

--connect jdbc:oracle:thin:@xyz.xyz.com:11234/TEST \

--username 'xyz' \

--password 'xyz' \

--hive-drop-import-delims -m 1 \

--fields-terminated-by , \

--escaped-by \\ \

--split-by EMPLOYEE_ID

解决方案

we can use to_char() function on the Oracle side:

use:

to_char(START_DATE, 'mm/dd/yyyy hh:mi:ss am')

instead of:

START_DATE

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值