Support Questions
Find answers, ask questions, and share your expertise

Get all DDL-info from hive metastore

Hi, i need to collect information like "create table" statment: table and schema names, columns and its types, comments and so on.


So, i'm able to collect table schema and table names and its location ("TBLS"), columns ("COLUMNS_V2") and table prooperties ("TABLE_PARAMS").

But i can't get any info about PK and partitions. Tables "PARTITIONS", "PARTITION_KEYS", "IDXS", "INDEX_PARAMS" are empty. So, i don't know where can i find information about. Where's it?

Of course, i create table with partitions and primary keys.


Oh, and i should be get type of table too: parquete, textfile or kudu-table. Havn't this info too.


more, i can't get DEFAULT value of column.

Have you added partitions to those tables? If not, then PARTITIONS table will certainly be empty. Try to add partitions first and then check those tables.

Same for Indexes.

I haven't be able to find where the primary key being stored, still checking.

Do not think Hive supports default values.

Metainfo "partitions" mast have information about rules for partition (what column, size of part), not "partition instances".
The same about index - need info about tuple of columns included into index.
; ;