nerdexam
Snowflake

SOL-C01 · Question #99

You are tasked with loading data from an external stage containing gzipped CSV files into a Snowflake table. The CSV files have a header row that you want to skip during the load process. Additionally

The correct answer is A. FILE_FORMAT = (TYPE = CSV, SKIP_HEADER = 1 , COMPRESSION = 'GZIP') D. TRANSFORM AS SELECT $1, $2, $3 II ' II $4 FROM @mystage/data.csv. Options A and D together cover both requirements: A correctly specifies FILE_FORMAT with TYPE = CSV, SKIP_HEADER = 1 to drop the header row, and COMPRESSION = 'GZIP' for the compressed files - all in valid Snowflake syntax. D uses Snowflake's inline SELECT transformation pattern,

Data Loading and Unloading

Question

You are tasked with loading data from an external stage containing gzipped CSV files into a Snowflake table. The CSV files have a header row that you want to skip during the load process. Additionally, you need to transform the data during the load, specifically concatenating two columns (FIRST NAME and LAST NAME) into a new column called FULL NAME. Which combination of the following COPY INTO options will accomplish this task? Choose all that apply.

Options

  • AFILE_FORMAT = (TYPE = CSV, SKIP_HEADER = 1 , COMPRESSION = 'GZIP')
  • BTRANSFORM = (FULL_NAME = FIRST_NAME II ' ' II LAST_NAME)
  • CON ERROR = 'SKIP FILE'
  • DTRANSFORM AS SELECT $1, $2, $3 II ' II $4 FROM @mystage/data.csv
  • EFILE FORMAT = (TYPE = CSV, SKIP_HEADER = 1, COMPRESSION = 'GZIP'), TRANSFORM

How the community answered

(28 responses)
  • A
    79% (22)
  • B
    7% (2)
  • C
    11% (3)
  • E
    4% (1)

Explanation

Options A and D together cover both requirements: A correctly specifies FILE_FORMAT with TYPE = CSV, SKIP_HEADER = 1 to drop the header row, and COMPRESSION = 'GZIP' for the compressed files - all in valid Snowflake syntax. D uses Snowflake's inline SELECT transformation pattern, referencing positional columns ($3, $4) and concatenating them with || (shown as II in the question), which is exactly how COPY INTO handles column-level transforms from a stage.

B is wrong because Snowflake has no TRANSFORM = (key = expression) option - that syntax doesn't exist; transformations must be a SELECT subquery in the FROM clause. C (ON ERROR = 'SKIP FILE') is a valid COPY INTO clause for error handling, but it does nothing for header skipping or column concatenation - it's a distractor that sounds plausible. E fails on two counts: FILE FORMAT (with a space) is a syntax error - Snowflake requires FILE_FORMAT (underscore) - and the trailing TRANSFORM keyword without a SELECT expression is not valid syntax.

Memory tip: "Format in FILE_FORMAT, transform in FROM (SELECT)" - Snowflake COPY INTO keeps these concerns separate; there is no magic TRANSFORM = shorthand.

Topics

#COPY INTO transformations#External stage loading#CSV GZIP compression#Column concatenation

Community Discussion

No community discussion yet for this question.

Full SOL-C01 Practice