Impala - 查找具有特定列的表
Impala - Find what tables have a specific column
在Impala中,有没有办法检查数据库中哪些表包含特定的列名?
类似于:
select tablename, columnname
from dbc.columns
where databasename = 'mydatabasename'
and columnname like '%findthis%'
order by tablename
上述查询在 teradata 环境中有效,但在 Impala 中抛出错误。
谢谢,
Impala 与 Hive 共享 Metastore。与传统的 RDBMS 不同,Hive 元数据存储在单独的数据库中。在大多数情况下,它位于 MySQL 或 Postgres 中。如果您有权访问 Metastore 数据库,则可以在 table TBLS 运行 SELECT 上获取有关 table 的详细信息,并可以 COLUMNS_V2 获取详细信息关于列。
如果您无权访问 Metastore,唯一的选择是描述每个 table 以获取列名。如果您有很多数据库和 tables,您可以编写一个 shell 脚本来使用 "show tables" 获取 tables 的列表并循环 table ]s 使用 "desc tablename".
来描述它们
在Impala中,有没有办法检查数据库中哪些表包含特定的列名?
类似于:
select tablename, columnname
from dbc.columns
where databasename = 'mydatabasename'
and columnname like '%findthis%'
order by tablename
上述查询在 teradata 环境中有效,但在 Impala 中抛出错误。
谢谢,
Impala 与 Hive 共享 Metastore。与传统的 RDBMS 不同,Hive 元数据存储在单独的数据库中。在大多数情况下,它位于 MySQL 或 Postgres 中。如果您有权访问 Metastore 数据库,则可以在 table TBLS 运行 SELECT 上获取有关 table 的详细信息,并可以 COLUMNS_V2 获取详细信息关于列。
如果您无权访问 Metastore,唯一的选择是描述每个 table 以获取列名。如果您有很多数据库和 tables,您可以编写一个 shell 脚本来使用 "show tables" 获取 tables 的列表并循环 table ]s 使用 "desc tablename".
来描述它们