What function, combined with the copy command, should be used to unload data from a relational table into a JSON file?
What function, combined with the copy command, should be used to unload data from a relational table into a JSON file?
To unload data from a relational table into a JSON file, you would use the OBJECT_CONSTRUCT function combined with the COPY command. OBJECT_CONSTRUCT takes the rows from the relational table and converts them into a single VARIANT column, which can then be unloaded into a JSON file. This function is specifically designed for the purpose of constructing JSON objects from table data.
D is correct: 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