I have created a table in hive, I would like to know which directory my table is created in?

HiveHiveql

Hive Problem Overview


I have created a table in hive, I would like to know which directory my table is created in? I would like to know the path...

Hive Solutions


Solution 1 - Hive

DESCRIBE FORMATTED my_table;

or

DESCRIBE FORMATTED my_table PARTITION (my_column='my_value');

Solution 2 - Hive

There are three ways to describe a table in Hive.

  1. To see table primary info of Hive table, use describe table_name; command

  2. To see more detailed information about the table, use describe extended table_name; command

  3. To see code in a clean manner use describe formatted table_name; command to see all information. also describe all details in a clean manner.

Resource: Hive interview tips

Solution 3 - Hive

You can use below commands for the same.

show create table <table>;
desc formatted <table>;
describe formatted <table>;

Solution 4 - Hive

DESCRIBE FORMATTED <tablename>

or

DESCRIBE EXTENDED <tablename>

I prefer formatted because it is more human readable format

Solution 5 - Hive

To see both of the structure and location (directory) of an any (internal or external)table, we can use table's create statment-

show create table table_name;

Solution 6 - Hive

in hive 0.1 you can use SHOW CREATE TABLE to find the path where hive store data.

in other versions, there is no good way to do this.

upadted:

thanks Joe K

use DESCRIBE FORMATTED <table> to show table information.

ps: database.tablename is not supported here.

Solution 7 - Hive

Further to pensz answer you can get more info using:

DESCRIBE EXTENDED my_table;

or

DESCRIBE EXTENDED my_table PARTITION (my_column='my_value');

Solution 8 - Hive

All HIVE managed tables are stored in the below HDFS location.

hadoop fs -ls /user/hive/warehouse/databasename.db/tablename

Solution 9 - Hive

If you use Hue, you can browse the table in the Metastore App and then click on 'View file location': that will open the HDFS File Browser in its directory.

Solution 10 - Hive

in the 'default' directory if you have not specifically mentioned your location.

you can use describe and describe extended to know about the table structure.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMuneer Basha SyedView Question on Stackoverflow
Solution 1 - HiveJoe KView Answer on Stackoverflow
Solution 2 - HiveVenu A PositiveView Answer on Stackoverflow
Solution 3 - HiveInfamousCoconutView Answer on Stackoverflow
Solution 4 - HiveNickView Answer on Stackoverflow
Solution 5 - HiveOm SinghView Answer on Stackoverflow
Solution 6 - HivepenszView Answer on Stackoverflow
Solution 7 - HiveSamuel KerrienView Answer on Stackoverflow
Solution 8 - HiveClementView Answer on Stackoverflow
Solution 9 - HiveRomainView Answer on Stackoverflow
Solution 10 - Hivenatarajan kView Answer on Stackoverflow