SnowPro Core Exam QuestionsBrowse all questions from this exam

SnowPro Core Exam - Question 1150


Which function is used to unload a relational table into a JSON file?

Show Answer
Correct Answer:

Discussion

4 comments
Sign in to comment
md_2000Option: D
Oct 13, 2024

D. TO_JSON Explanation: TO_JSON is used to convert relational data into JSON format, which is ideal when unloading a relational table into a JSON file. Why the others are wrong: A. PARSE_JSON: This function is used to parse a JSON string into a Snowflake-compatible format, not for converting relational data into JSON. B. JSON_EXTRACT_PATH_TEXT: This function extracts specific values from JSON data, but it doesn't convert relational data into JSON. C. OBJECT_CONSTRUCT: This creates a JSON object from key-value pairs, but it doesn't convert the entire relational data into JSON format. Example of using TO_JSON: SELECT TO_JSON(OBJECT_CONSTRUCT(*)) FROM my_table;

MatthieuDNOption: D
Jan 23, 2025

D is correct, I think the first two are for unloading json and C needs the COPY INTO [location] to successfully unload json

MatthieuDNOption: C
Jan 27, 2025

I'm changing my answer to C

NPass
Feb 4, 2025

Answer is D. OBJECT_CONSTRUCT Returns an OBJECT constructed from the arguments -- NOT JSON

pieterjacobi1Option: D
Jan 29, 2025

The TO_JSON function in Snowflake is used to convert relational data into a JSON-formatted string. It is the appropriate function to use when unloading a relational table into a JSON file, as it serializes the data into a JSON representation.