77

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...

10 Answers 10

102

DESCRIBE FORMATTED my_table;

or

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

3
  • This answer is excellent... Thank you very much Joe... I can find every thing here about my table. Nov 2, 2012 at 19:05
  • 3
    This works very fine.. Any idea how we can see all partitions info in one command?
    – minhas23
    Sep 10, 2015 at 7:08
  • I have a maprfs system. I am trying to find the location of the file for which hive view is created. I am describing the hive view. but i am not seeing the location option there. Can u help!
    – semicolon
    Mar 11, 2022 at 10:07
26

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

15

You can use below commands for the same.

show create table <table>;
desc formatted <table>;
describe formatted <table>;
12
DESCRIBE FORMATTED <tablename>

or

DESCRIBE EXTENDED <tablename>

I prefer formatted because it is more human readable format

8

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;
5

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.

2
  • What can I do to see that info for a table in the non default database. I can't provide the database in that command?
    – ludwigm
    Jul 11, 2013 at 21:48
  • confirmative.DESCRIBE FORMATTED <table> does work while SHOW CREATE TABLE does not work Aug 30, 2018 at 6:05
3

Further to pensz answer you can get more info using:

DESCRIBE EXTENDED my_table;

or

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

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

hadoop fs -ls /user/hive/warehouse/databasename.db/tablename
2
  • 4
    That looks very specific upon the installation/configuration, no ? Apr 20, 2016 at 16:51
  • this is exactly the question Apr 9, 2018 at 16:07
1

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.

0

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.