Not able to see imported tables through hive> prompt for import-all-tables command

#1

Hi,

[cloudera@quickstart ~]$ sqoop import-all-tables -m 12 --connect “jdbc:mysql://quickstart.cloudera:3306/retail_db” --username=retail_dba --password=cloudera --as-textfile --warehouse-dir=/user/hive/warehouse/sqoop_import.db

I am able to see the imported tabled on hdfs as below

[cloudera@quickstart ~]$ hadoop fs -ls /user/hive/warehouse/sqoop_import.db
Found 6 items
drwxr-xr-x - cloudera hive 0 2016-12-28 08:45 /user/hive/warehouse/sqoop_import.db/categories
drwxr-xr-x - cloudera hive 0 2016-12-28 08:46 /user/hive/warehouse/sqoop_import.db/customers
drwxr-xr-x - cloudera hive 0 2016-12-28 08:46 /user/hive/warehouse/sqoop_import.db/departments
drwxr-xr-x - cloudera hive 0 2016-12-28 08:47 /user/hive/warehouse/sqoop_import.db/order_items
drwxr-xr-x - cloudera hive 0 2016-12-28 08:48 /user/hive/warehouse/sqoop_import.db/orders
drwxr-xr-x - cloudera hive 0 2016-12-28 08:48 /user/hive/warehouse/sqoop_import.db/products

But when I am trying to see the tables through hive> prompt it is showing 0 tables.

hive> use sqoop_import;
OK
Time taken: 71.444 seconds
hive> show tables;
OK
Time taken: 0.165 seconds

Please suggest.

0 Likes

#2

You have to run it as --hive-import

0 Likes

#3

Thanks, it is working now but on hive default.

hive> show databases;
OK
default
retail_stage
sqoop_import
Time taken: 0.009 seconds, Fetched: 3 row(s)
hive> show tables;
OK
categories
customers
departments
departments_nopk
order_items
orders
products
Time taken: 0.013 seconds, Fetched: 7 row(s)
hive> use sqoop_import;
OK
Time taken: 0.016 seconds
hive> show tables;
OK
Time taken: 0.012 seconds
hive>

I need the tables in sqoop_import which i cannot see through hive.

0 Likes

#4

@surajminz1 - You have to use --hive-database sqoop_import, which will store the tables in this database.

When you use import single table you can use give with --hive-table sqoop_import.

in this case you don’t need to specify --hive-database.
0 Likes

#5

For that you need to use undocumented parameter --hive-database sqoop_import

0 Likes

#6

@gnanaprakasam, thanks for your reply. I am using import-all-tables, sorry for the typo “import table”

@itversity, I used --hive-database sqoop_import then too i was getting only 2 tables in sqoop_import and other 4 were getting missed.

@gnanaprakasam, @itversity, but when i used “sudo -u hive” before <sqoop import-all-tables > i got all the tables in sqoop_import.

0 Likes