Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
319 views
in Technique[技术] by (71.8m points)

Snowflake COPY INTO Export Producing Unreadable File

Testing export functionality in Snowflake and having a hard time getting a readable file back.

Using the below command on:

COPY INTO 'azure://my_account.blob.core.windows.net/test-folder/test_file_8.csv'
FROM (SELECT * FROM DEMO_DB.INFORMATION_SCHEMA.DATABASES)
credentials = (azure_sas_token='my_sas_token')
FILE_FORMAT = (TYPE = CSV RECORD_DELIMITER = ',')
HEADER = TRUE
SINGLE = TRUE

I'm getting the following back: See Exported Data

What am I doing wrong?

question from:https://stackoverflow.com/questions/65939852/snowflake-copy-into-export-producing-unreadable-file

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

From COPY INTO docs:

If SINGLE = TRUE, then COPY ignores the FILE_EXTENSION file format option and outputs a file simply named data. To specify a file extension, provide a filename and extension in the internal or external location path

COPY INTO @mystage/data.csv ...

and:

COMPRESSION = AUTO | GZIP | BZ2 | BROTLI | ZSTD | DEFLATE | RAW_DEFLATE | NONE

String (constant) that specifies to compresses the unloaded data files using the specified compression algorithm.

Supported Values
AUTO Unloaded files are automatically compressed using the default, which is gzip.

**Default: AUTO**

Either do not compress file(compression method NONE) or provide a proper file name with gz extension: COPY INTO 'azure://my_account.blob.core.windows.net/test-folder/test_file_8.csv.gz'


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...