COF-C02 practice question 8 of 35

When unloading to a stage, which of the following is a recommended practice or approach?

Full set: 778 questions
Answer options
A: Set SINGLE: = true for larger files
B: Use OBJECT_CONSTRUCT ( * ) when using Parquet
C: Avoid the use of the CAST function
D: Define an individual file format Correct answer
Correct Answer:
D. Define an individual file format
Explanation

Defining a named file format is a recommended practice when unloading data. A named file format is a reusable, schema-level object that encapsulates all the necessary format-specific information (e.g., TYPE, COMPRESSION, FIELDDELIMITER). Using a named file format promotes consistency across multiple unload operations, simplifies the COPY INTO command by referencing the object instead of listing options inline, and improves overall manageability and governance of data pipelines. This approach decouples the file format definition from the data movement logic, making the process more modular and easier to maintain.

Why Incorrect

A. Set SINGLE = true for larger files This is incorrect. Setting SINGLE = true forces the unload operation into a single thread, which severely degrades performance, especially for larger files. The recommended practice for large datasets is to unload in parallel to multiple files.
B. Use OBJECTCONSTRUCT ( ) when using Parquet This is incorrect. Parquet is a columnar format. Using OBJECTCONSTRUCT() would combine all columns into a single VARIANT object, negating the benefits of Parquet's columnar structure and query performance.
C. Avoid the use of the CAST function This is incorrect. The CAST function and other transformation functions are frequently necessary during unloading to format data, convert data types, or restructure the output to meet the requirements of the target system. ---

References

1. Correct Answer (D): Snowflake Documentation

"Preparing to Unload Data". This section outlines the prerequisite steps for unloading

which includes creating named file formats. It states

"Create a named file format that describes the format of your data files... You can also specify file format options in the COPY INTO command." Creating the object beforehand is presented as a standard

reusable approach.

Source: Snowflake Documentation > Data Loading & Unloading > Unloading Data > Preparing to Unload Data.

2. Incorrect Option (A): Snowflake Documentation

"COPY INTO ". The description for the SINGLE copy option explicitly warns against its use for large data sets. It states

"Note that the unload operation will be slower [with SINGLE = TRUE]. For the best performance

unload to multiple files."

Source: Snowflake Documentation > SQL Reference > DML Commands > COPY INTO > Optional Parameters > SINGLE = TRUE | FALSE.

3. Incorrect Option (B): Snowflake Documentation

"Unloading data into a Parquet file". The examples show selecting individual columns to be mapped to columns in the Parquet file

preserving the columnar structure. There is no recommendation to use OBJECTCONSTRUCT()

which would be counter-intuitive for this format.

Source: Snowflake Documentation > Data Loading & Unloading > Unloading Data > Unloading data into a Parquet file.

4. Incorrect Option (C): Snowflake Documentation

"Data Unloading Considerations". This page discusses transforming data during an unload. It provides examples of using functions within the SELECT statement of the COPY command to format the data

which often involves CAST or similar functions (e.g.

TOCHAR

TOVARCHAR).

Source: Snowflake Documentation > Data Loading & Unloading > Unloading Data > Data Unloading Considerations > Transforming Data During an Unload.

Scroll to Top