TransWikia.com

Impala query Result Storing into variable

Unix & Linux Asked by Harkirat Singh on February 23, 2021

****I have impala query **var=impala-shell --ssl -B --quiet -q " show tables in db_name**" **and I want to store output of query into variable .I am able to store
but it is store extra information which I want to remove by using Impala command line options .This is the extra information which I am getting in the result and want to remove****

(Starting Impala Shell without Kerberos authentication SSL is enabled.
Impala server certificates will NOT be verified (set –ca_cert to
change) Error connecting: TTransportException, TSocket read 0 bytes
Kerberos ticket found in the credentials cache, retrying the
connection with a secure transport.

**

Note: [ I do not want to redirect to file ,I know it works ]

One Answer

In my experience ,

you get the output of query in a variable as follows

var=$(impala-shell --ssl -B --quiet -q " show tables in db_name")

This should contain only the query output and not any other information such as

"Starting Impala Shell without Kerberos authentication SSL is enabled....Fetched 1 rows in 1 sec.etc "

In case you want this information also in a variable , you can do as follows

var=$(impala-shell --ssl -B --quiet -q " show tables in db_name" 2>&1)

see https://stackoverflow.com/a/50857918/3840541 for more details

Answered by kartik on February 23, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP