通过Sqoop将Oracle中的数据导入Hive,并在Oracle中使用日期格式

时间:2018-03-27 16:59:14

标签: oracle hive sqoop

我想将一个带有日期格式的表从Sqoop导入到Hive数据库。我不明白为什么Hive中的导入字段是字符串而不是时间戳(如Oracle)。我更喜欢不使用map-colum-hive,因为我想为每个表的每种日期格式自动执行此操作。

这是我的Sqoop请求:

  

sqoop import -D mapDateToTimestamp = true --direct --connect   jdbc:oracle:thin:@ // $ connection --username $ username -password   $ password -m 7 --table $ table1 --hive-import --hive-overwrite   --hive-database $ database1 --hive-table $ table2 - 其中“$ date> to_date('$ dd / mm / yyyy hh:mm:ss','dd / mm / yyyy hh24:mi:ss') “   --null-string'\ N' - null-non-string'\ N'--target-dir $ targetdirectory - --schema $ schema

我尝试使用 mapDateToTimestamp = True oracle.jdbc.mapDateToTimestamp = True 两者,导入数据,但日期格式的数据是字符串。

你有解决方案吗?建议?建议?

非常感谢!

0 个答案:

没有答案