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