配置单元元存储中的查询表和列注解

dfuffjeb  于 2021-06-26  发布在  Hive
关注(0)|答案(1)|浏览(451)

我正在尝试找出如何在配置单元元存储中查询表和列注解(描述)。如果有一种方法可以将注解添加到配置单元表/列,那么不应该有一种方法可以查询/报告来自配置单元元存储的注解吗?
请帮忙:)
致以最诚挚的问候,迈克尔

q3qa4bjr

q3qa4bjr1#

SELECT DBS.NAME AS OWNER,
        TBLS.TBL_NAME as OBJECT_NAME,
        TBL_COMMENTS.TBL_COMMENT as OBJECT_DESCRIPTION,
        TBLS.TBL_ID as OBJECT_ID,
        TBLS.TBL_TYPE as OBJECT_TYPE,
        'VALID' as OBJECT_STATUS,
        COLUMNS_V2.COLUMN_NAME,
        COLUMNS_V2.COMMENT as COLUMN_DESCRIPTION,
        COLUMNS_V2.TYPE_NAME AS DATA_TYPE,
        'Y' as NULL_IND,
        'N' as PRIMARY_KEY_IND,
        TBLS.CREATE_TIME as LAST_DDL_TIME
FROM    DBS
        JOIN TBLS 
                ON DBS.DB_ID = TBLS.DB_ID
        JOIN SDS 
                ON TBLS.SD_ID = SDS.SD_ID
        JOIN COLUMNS_V2 
                ON COLUMNS_V2.CD_ID = SDS.CD_ID
        JOIN (SELECT    DISTINCT 
                        TBL_ID, 
                        TBL_COMMENT 
              FROM     (SELECT  TBLS.TBL_ID TBL_ID, 
                                TABLE_PARAMS.PARAM_KEY, 
                                TABLE_PARAMS.PARAM_VALUE, 
                                CASE WHEN TABLE_PARAMS.PARAM_KEY = 'comment' 
                                        THEN TABLE_PARAMS.PARAM_VALUE 
                                                ELSE '' 
                                END TBL_COMMENT
                        FROM    TBLS 
                                JOIN TABLE_PARAMS
                                        ON TBLS.TBL_ID = TABLE_PARAMS.TBL_ID) TBL_COMMENTS_INTERNAL) TBL_COMMENTS 
                ON TBLS.TBL_ID = TBL_COMMENTS.TBL_ID;

相关问题