I am running SnowQL queries like so –
snowsql -u user -w cluster -d db -s public -a "account" -r admin -q "SELECT bucket FROM buckets GROUP BY bucket" | while read bucket_name_var ;
do
if [ ! -z "$bucket_name_var" ]
then
fi
done
This is the output it produces –
* SnowSQL * v1.2.20
Type SQL statements or !help
+-------------+
| BUCKET
|-------------|
| 960 |
+-------------+
1 Row(s) produced. Time Elapsed: 0.927s
Goodbye!
How do I get this output instead –
960
I want this output so that bucket_name_var variable will only have output values (e.g. 960) that can be looped because right now everything from the version of Snowflake to goodbye is being looped on.
>Solution :
Add this to your snowsql command to get raw output:
-o friendly=false -o header=false -o timing=false -o output_format=plain
Reference: https://snowflakecommunity.force.com/s/article/SnowSQL-display-raw-result-of-a-query