Format output of query

0

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.

bash snowflake-cloud-data-platform sql
2021-11-23 21:25:23
1

0

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

2021-11-23 21:42:58

In other languages

This page is in other languages

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................