Skip to Content

Snowflake SnowPro Core: How to Unload Data into a Single File in Snowflake?

Learn how to use the SINGLE=TRUE option with the Snowflake COPY command to unload data from a table or query into a single output file in the specified stage location.

Table of Contents

Question

While unloading data into a stage, how can the user ensure that the output will be a single file?

A. Use the COPY option FILES=SINGLE.
B. Use the COPY option SINGLE=TRUE.
C. Use the GET option SINGLE=TRUE.
D. Use the GET option FILES=SINGLE.

Answer

B. Use the COPY option SINGLE=TRUE.

Explanation

When unloading data from a table or query into a stage using the COPY command in Snowflake, you can specify the SINGLE=TRUE option to ensure that the output will be a single file rather than multiple files.

For example:

COPY INTO @my_stage/unload/
FROM my_table
FILE_FORMAT = (TYPE=CSV)
SINGLE=TRUE;

This will unload the contents of my_table into a single CSV file in the @my_stage/unload/ stage location.

The other options are incorrect:

  • FILES=SINGLE is not a valid COPY option
  • SINGLE=TRUE is not a valid option for the GET command, which is used to download files from stages, not unload data
  • FILES=SINGLE is not a valid GET option

So in summary, to unload data into a single file in a Snowflake stage, use the COPY command with the SINGLE=TRUE option.

Snowflake SnowPro Core certification exam assessment practice question and answer (Q&A) dump including multiple choice questions (MCQ) and objective type questions, with detail explanation and reference available free, helpful to pass the Snowflake SnowPro Core exam and earn Snowflake SnowPro Core certification.