Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hive is not showing tables

Tags:

hadoop

hive

I am new to Hadoop and Hive world.

I have a strange problem. When I was working on hive prompt. I have created few tables and hive was showing those tables.

After exiting Hive session when I am again starting Hive terminal "show tables;" is not showing any table!. I can see tables in '/user/hive/warehouse' in HDFS.

What is wrong am I doing. Can you please help me on this?

like image 512
Bhagwant Avatar asked Jan 20 '14 06:01

Bhagwant


People also ask

How do I show tables in Hive?

Issue the SHOW TABLES command to see the views or tables that exist within workspace. Switch to the Hive schema and issue the SHOW TABLES command to see the Hive tables that exist. Switch to the HBase schema and issue the SHOW TABLES command to see the HBase tables that exist within the schema.

How do I find the number of tables in Hive?

you can use the below sql statement in the metastore database. tables. txt will have the list of all tables.

Does Hive have tables?

Managed tables are Hive owned tables where the entire lifecycle of the tables' data are managed and controlled by Hive. External tables are tables where Hive has loose coupling with the data.


2 Answers

BalduZ is right . set this in $HIVE_HOME/conf/hive-site.xml

property name = javax.jdo.option.ConnectionURL

property value = jdbc:derby:;databaseName=/home/youruser/hive_metadata/metastore_db;create=true

Next time onwards you can run hive from any dir location. This will solve your problem.

like image 123
vijay kumar Avatar answered Sep 20 '22 11:09

vijay kumar


I assume you are using the default configuration, so the problem is where you call hive to start working, since you need to call it from the same directory in order to see the tables you created in the previous hive session.

For example, if you call hive when you are in ~/test/hive and create some tables, and the next time you use hive you start it from ~/test you will not see the tables you created earlier. The easiest solution is to always start hive from the same directory.

However, a better solution would be to configure hive so that it uses a database like MySQL as a metastore. You can find how to do this here.

like image 38
Balduz Avatar answered Sep 21 '22 11:09

Balduz