data disapear import sqoop hive oracle

154 views Asked by At

I mamage to connect to DB and import data from oracle to file or to HIVE. But now, i would like to import data from query into Hive using sqoop on oracle.

I previously used the following : sqoop import --connect 'jdbc:oracle:thin:@server1:1521:ICIS' -P -- username JAPHONIE --query 'SELECT * FROM CONTRACTS INNER JOIN CONTRACT_VERSIONS ON CV_CON_NUMBER = CON_NUMBER WHERE $CONDITIONS' --target-dir BOUH --split-by CON_NUMBER --where '1=1'

This one create my data in my folder BOUH, there is no problem on this point.

But when i use the following : sqoop import --connect 'jdbc:oracle:thin:@server1:1521:ICIS' -P --username JAPHONIE --query 'SELECT * FROM CONTRACTS INNER JOIN CONTRACT_VERSIONS ON CV_CON_NUMBER = CON_NUMBER WHERE $CONDITIONS' --target-dir BOUH --split-by CON_NUMBER --where '1=1' --hive-import --hive-table BOUH

My BOUH folder contains only _SUCCESS, no data, and the table in HIVE is created but empty... I dont understand where doest the problem come from. I dont have any error message either...

do you have any idea ?

EDIT : I manage to load my table by, first, execute the 2nd query which creates the table without data, then delete the file folder which is empty and execute the 1st query which extract properly the data... but i would like to do the same in one query...

1

There are 1 answers

1
gbharat On

The data you imported will be saved under /user/hive/warehouse as it is an internal hive table, It won't be saved in the BOUH folder you have mentioned in --target-dir. Your script is correct and you should be able to see data in hive table , as you are saying you are not able to see data, please look at /user/hive/warehouse folder once. Still if you are not able to see data, please paste sqoop logs here.