BIG DATA
[HIVE] 메타스토어 직접 접속해서 테이블 정보 확인 및 수정
코린이s
2023. 9. 11. 11:39
728x90
메타 스토어 직접 접속해서 테이블 정보 조회 하는 방법
SELECT d.NAME as DB_NAME,TBL_NAME AS TABLE_NAME,COLUMN_NAME, TYPE_NAME AS COLUMN_TYPE FROM TBLS t
JOIN DBS d
ON t.DB_ID = d.DB_ID
JOIN SDS s
ON t.SD_ID = s.SD_ID
JOIN COLUMNS_V2 c
ON s.CD_ID = c.CD_ID
WHERE d.NAME='{database name}' AND TBL_NAME='{table name}' AND COLUMN_NAME='{column name}'
ORDER by INTEGER_IDX;
칼럼 타입 수정
UPDATE COLUMNS_V2 SET TYPE_NAME="string" WHERE CONCAT(CD_ID, COLUMN_NAME) = (
SELECT a.C_PK FROM (
SELECT concat(c.CD_ID, c.COLUMN_NAME) as C_PK FROM TBLS t
JOIN DBS d
ON t.DB_ID = d.DB_ID
JOIN SDS s
ON t.SD_ID = s.SD_ID
JOIN COLUMNS_V2 c
ON s.CD_ID = c.CD_ID
WHERE d.NAME='{database name}' AND TBL_NAME='{table name}' and COLUMN_NAME ='{column name}'
) a
);
728x90