SnowPro Advanced: Architect — Question 166
An Architect needs to define a table structure for an unfamiliar semi-structured data set. The Architect wants to identify a list of distinct key names present in the semi-structured objects.
What function should be used?
Answer options
- A. FLATTEN with RECURSIVE argument
- B. INFER_SCHEMA
- C. PARSE_JSON
- D. RESULT SCAN
Correct answer: A
Explanation
The FLATTEN function with the RECURSIVE argument is specifically designed to extract nested data structures and retrieve distinct key names from semi-structured data. INFER_SCHEMA is used to determine the schema based on data content but does not directly provide distinct keys. PARSE_JSON is utilized to convert string representations of JSON into a JSON object, while RESULT SCAN is for accessing the results of a previous query, making them unsuitable for this requirement.