How can a relational table be unloaded into a JSON file?
How can a relational table be unloaded into a JSON file?
https://docs.snowflake.com/en/user-guide/data-unload-considerations#unloading-a-relational-table-to-json
-- Unload the data to a file in a stage COPY INTO @mystage FROM (SELECT OBJECT_CONSTRUCT('id', id, 'first_name', first_name, 'last_name', last_name, 'city', city, 'state', state) FROM mytable) FILE_FORMAT = (TYPE = JSON); -- The COPY INTO location statement creates a file named data_0_0_0.json.gz in the stage.
Please, disregard. The question does not say anything about an Object_Construct. Right answer is B.
The question does not say anything about an Object_Construct. Right answer is B.
A is correct
A, seen many times
Unloading a relational table to JSON You can use the OBJECT_CONSTRUCT function combined with the COPY command to convert the rows in a relational table to a single VARIANT column and unload the rows into a file. https://docs.snowflake.com/en/user-guide/data-unload-considerations