这是我们的设置 - 我们有Hive在另一台机器上使用MySQL作为Metastore.我可以启动Hive命令行shell并创建一个表并对其进行描述.但是当我登录到用作Metastore的其他机器时,我无法在MySQL上看到Hive表的详细信息.
这里有蜂巢命令 -
hive> create table student(name STRING, id INT);
OK
Time taken: 7.464 seconds
hive> describe student;
OK
name string
id int
Time taken: 0.408 seconds
hive>
Run Code Online (Sandbox Code Playgroud)
接下来,我登录到安装了MySQL的机器,这个MySQL用作Hive Metastore.我使用"Metastore"数据库.但是,如果我想列出表格,我无法看到我在Hive中创建的表格或表格信息.
如何在Metastore中查看Hive表信息?
kgu*_*u87 15
首先,找到存储Metastore的MySql数据库.这将在你的hive-site.conf - 连接URL中.然后,一旦连接到MySql就可以了
use metastore;
show tables;
select * from TBLS; <-- this will give you list of your hive tables
Run Code Online (Sandbox Code Playgroud)
如果要搜索特定列所属的其他表,则另一个有用的查询:
SELECT c.column_name, tbl_name, c.comment, c.type_name, c.integer_idx,
tbl_id, create_time, owner, retention, t.sd_id, tbl_type, input_format, is_compressed, location,
num_buckets, output_format, serde_id, s.cd_id
FROM TBLS t, SDS s, COLUMNS_V2 c
-- WHERE tbl_name = 'my_table'
WHERE t.SD_ID = s.SD_ID
AND s.cd_id = c.cd_id
AND c.column_name = 'my_col'
order by create_time
Run Code Online (Sandbox Code Playgroud)