Support Questions
Find answers, ask questions, and share your expertise
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here. Want to know more about what has changed? Check out the Community News blog.

Get all DDL-info from hive metastore


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.


Re: Get all DDL-info from hive metastore

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

Re: Get all DDL-info from hive metastore

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.

Re: Get all DDL-info from hive metastore

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.