nerdexam
Snowflake

COF-C02 · Question #631

Which Snowflake function and command combination should be used to convert rows in a relational table to a single VARIANT column, and unload the rows Into a file in JSON format? (Select TWO).

The correct answer is C. COPY E. OBJECT CONSTRUCT. OBJECT_CONSTRUCT is a Snowflake SQL function that takes column names and values and assembles them into a VARIANT (semi-structured JSON) object, effectively converting a relational row into a single JSON object. COPY INTO <location> (the COPY command) is then used to unload the…

Data Loading and Unloading

Question

Which Snowflake function and command combination should be used to convert rows in a relational table to a single VARIANT column, and unload the rows Into a file in JSON format? (Select TWO).

Options

  • APUT
  • BGET
  • CCOPY
  • DEXPORT
  • EOBJECT CONSTRUCT

How the community answered

(32 responses)
  • A
    13% (4)
  • B
    3% (1)
  • C
    75% (24)
  • D
    9% (3)

Explanation

OBJECT_CONSTRUCT is a Snowflake SQL function that takes column names and values and assembles them into a VARIANT (semi-structured JSON) object, effectively converting a relational row into a single JSON object. COPY INTO <location> (the COPY command) is then used to unload the resulting VARIANT data to an internal or external stage in JSON format by specifying FILE_FORMAT = (TYPE = JSON). PUT uploads local files to a stage but does not transform data. GET downloads files from a stage to a local path. EXPORT is not a valid standalone Snowflake command for this purpose.

Topics

#Data Unloading#JSON Format#VARIANT Data Type#OBJECT_CONSTRUCT Function

Community Discussion

No community discussion yet for this question.

Full COF-C02 Practice