Get the App
SLTechnology News&Howtos  ›  Development  › 

How does mysql get the metadata information of hive table

Shulou Source: shulou.com Published: 2022-06-03 17:34:08 11月13日 Update

This article introduces the relevant knowledge of "how to obtain the metadata information of hive table by mysql". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Description

1. Get it through the meta-database of hive (usually Msyql) and through the association of sql.

2. Get the table name and creation time, library name and library comments, and use S_ID as the association relationship to obtain C_ID. Field names and field comments are in the table.

Example

SELECT t2.`NAME``NAME``database_ name`,-- library name t2.`DESC``column_ comment`,-- library annotation t1.`TBL _ NAME``table_ name`,-- table name t3.`PARAM _ VALUE``column_ commet`,-- table annotation FROM_UNIXTIME (t1.`CREATE _ time`) `table_create_ time`,-- table creation time t5.`COLUMN _ name `column_ name`,-- field name t5.`COMMENT` -- Field note t5.`TYPE _ NAME`` column_data_ type`-- Field data type FROM tbls T1-- get table name and table creation time JOIN dbs T2-- get library name and library comment ON t1.DB_ID = t2.DB_ID-- use library ID as the association JOIN (SELECT TBL_ID, PARAM_KEY) PARAM_VALUE FROM table_params-get table comment WHERE PARAM_KEY = 'comment') t3ON t1.TBL_ID = t3.TBL_IDJOIN sds T4-get C_ID Used to get field comments ON t1.SD_ID = t4.SD_ID-- use S_ID as an association to obtain C_IDJOIN columns_v2 T5-- field names and field comments are all in this table, ON t4.CD_ID = t5.CD_ID. This is the end of the content of "how mysql obtains the metadata information of the hive table". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Comments fields data name association time information content more knowledge practicality achievement next dilemma example actual situation database article case Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Microsoft Shulou Information Linux MySQL