snowsql option while exporting data to a csv file in unix

566 Views Asked by At

we are exporting data into a csv file by using unix shell script (using snowsql) below is the script #!/bin/ksh

snowsql -c newConnection  -o log_level=DEBUG -o
log_file=~/snowsql_sso_debug.log -r SRVC_ACCT_ROLE  -w LOAD_WH -d
ETL_DEV_DB -s CTL_DB -q "select * from mytable" -o friendly=False -o
header=False -o output_format=pipe -o timing=False>test_file.csv

output starts something like below

|:--------|:-----------|

i dont want to display above lines in my csv file, what is the option that we need to use in my snowsql query?

appricate your response. Thanks.

1

There are 1 best solutions below

1
On

Providing my comment as an answer, just in case it works better for you.

I would leverage a COPY INTO command to create a CSV file to an internal stage location:

https://docs.snowflake.com/en/sql-reference/sql/copy-into-location.html

And then use a GET statement to pull the file down to your Unix machine.

https://docs.snowflake.com/en/sql-reference/sql/get.html

This gives you greater control over the output format and will likely perform faster, as well.