Hive- database in warehouse directory not showing under hive


#1

Hi,

I did a sqoop import all tables to a db called pig_demo.db in the warehouse directory
/user/hive/warehouse/pig_demo.db.
And it got completed successfully.
When I give:
hadoop fs -ls /user/hive/warehouse
I’m able to see the db created.

But when I go in the hive prompt and give show databases, the imported db in the warehouse directory is not showing.

show databases is not show pig_demo.db

What should I do to show in the hive, which is there in the warehouse directory ? !! Thanks!


Practice hive on state of the art Big Data cluster - https://labs.itversity.com



#2

@Mathews Try with hive-import.
Add commands like:

  --hive-import \
  --hive-database database_name \
  --hive-overwrite \
  --create-hive-table \

#3

Dear @Mathews,

Sqoop import created a folder named as pig_demo.db that’s it and it will not be listed as db as in hive.
You will not be able to create db in hive through sqoop. First you have to create the pig_demo database through hive shell. Please validate if db is created using “show databases”.
Then use the db in sqoop import command.

sqoop import-all-tables connection-string \
--hive-import \
--hive-home /user/hive/warehouse \
--hive-database pig_demo
--create-hive-table \
-m 1

#4

Thanks very much @annapurna and @venkateshm. My understanding was that warehouse directory is default db directory of Hive and it will display the dbs from there.
Thanks again for explaining.


#5

No, it will not. Unless you perform Hive import, it does not know to which database and tables directories belong to.


#6