Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Impala: Show tables like query

I am working with Impala and fetching the list of tables from the database with some pattern like below.

Assume i have a Database bank, and tables under this database are like below.

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

Now i am filtering like

show tables in bank like '*cust*'

It is returning the expected results like, which are the tables has a word cust in its name.

Now my requirement is i want all the tables which will have cust in its name and table should not have quarter2.

Can someone please help me how to solve this issue.

like image 968
Manindar Avatar asked Mar 24 '17 12:03

Manindar


People also ask

How do I view the partitions on my Impala?

SHOW FILES Statement. The SHOW FILES statement displays the files that constitute a specified table, or a partition within a partitioned table. This syntax is available in Impala 2.2 and higher only. The output includes the names of the files, the size of each file, and the applicable partition for a partitioned table.

How do I find tables in all Hive databases?

'Show tables' displays all the tables within Hive. Show databases displays all the database name.


1 Answers

Execute from the shell and then filter

impala-shell -q "show tables in bank like '*cust*'" | grep -v 'quarter2'
like image 195
David דודו Markovitz Avatar answered Sep 19 '22 14:09

David דודו Markovitz