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…
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)- A13% (4)
- B3% (1)
- C75% (24)
- D9% (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
Community Discussion
No community discussion yet for this question.