Prasad mangalagiri
Prasad mangalagiri

Reputation: 31

How to get the count of impala table records into a variable in shell script

I am trying to run below impala query to get the table count from shell scripting.

Select count(*) as count from impala table name.

Count

1000

I need to capture 1000 into shell variable to be used in some calculation. Can some one help how to do this. Thanks.

Upvotes: 1

Views: 1628

Answers (1)

Vijay Krishna
Vijay Krishna

Reputation: 1067

This should work

x="$(impala-shell -q 'select count(*) from table_name' -B)"
echo "$x"

Upvotes: 1

Related Questions