I have a requirement wherein I need to count the number of records in a gcloud hive table and need to store this result inside a variable.
Below is the code for the same:
test=$(gcloud dataproc jobs submit hive --cluster=$CLUSTER --region=$REGION --execute="select count(*) from db.table;")
However, the above variable is not storing the count of records but is storing some logs which not useful for me.
Can please someone help me to find out how can we redirect the output of above query inside a variable.