【问题标题】:Impala: Show tables like queryImpala:显示类似查询的表
【发布时间】:2017-03-24 12:27:56
【问题描述】:

我正在使用 Impala 并使用如下模式从数据库中获取表列表。

假设我有一个数据库bank,这个数据库下的表如下所示。

cust_profile
cust_quarter1_transaction
cust_quarter2_transaction
product_cust_xyz
....
....
etc

现在我正在过滤

show tables in bank like '*cust*'

它正在返回预期的结果,例如,表的名称中有一个单词 cust

现在我的要求是我想要所有名称中包含cust 的表,并且表中不应包含quarter2

谁能帮我解决这个问题。

【问题讨论】:

    标签: hive cloudera hiveql cloudera-cdh impala


    【解决方案1】:

    从shell执行然后过滤

    impala-shell -q "show tables in bank like '*cust*'" | grep -v 'quarter2'
    

    【讨论】:

      【解决方案2】:

      查询元存储

       mysql -u root -p -e "select TBL_NAME from metastore.TBLS where TBL_NAME like '%cust%' and TBL_NAME not like '%quarter2%'";
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2012-08-06
        • 2020-12-21
        • 2014-06-17
        • 2021-12-31
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多