SnowPro Associate: Platform Question 317
Single answer● PARSE_DOCUMENT functionA data engineering team stores scanned supplier invoices as PDF files in an internal stage. They want to extract the document content into a queryable Snowflake value so they can inspect the parsed output before building downstream SQL transformations. The team wants to use a built-in SQL function rather than an external OCR service. Which approach best meets this requirement?
- A
Select from the staged PDF file and call PARSE_DOCUMENT on the file to return a structured document representation that can be queried in SQL.
- B
Use PARSE_JSON directly on the staged PDF file because PDF is automatically converted into JSON by Snowflake when read from a stage.
- C
Call COPY INTO a relational table with AUTO_DETECT=TRUE to load the PDF into columns, because Snowflake automatically maps PDF pages to table rows.
- D
Create an external function that sends the PDF to a third-party OCR API, because Snowflake does not provide a built-in function for parsing document files.
Show answer and explanation
Correct answer: A
Explanation
The best answer is to use PARSE_DOCUMENT on the staged PDF so Snowflake can produce a structured document output that the team can inspect with SQL. This aligns with the requirement to stay inside Snowflake and avoid external OCR services. PARSE_JSON is only for JSON-formatted text, not binary document files such as PDFs. COPY INTO loads data but does not parse PDF layout or content into relational columns automatically. An external function could be used in a custom architecture, but it is unnecessary when Snowflake's built-in PARSE_DOCUMENT function is available. Candidates should recognize the practical distinction between document parsing functions and traditional semi-structured data loading/parsing functions documented in Snowflake SQL function references.
- A. Correct.
Correct. PARSE_DOCUMENT is the built-in Snowflake SQL function intended for parsing supported document files, such as PDFs, into a structured representation that can be consumed in SQL. This fits the scenario because the team wants to inspect parsed document content inside Snowflake before designing downstream transformations, without relying on an external OCR service.
- B. Incorrect.
Incorrect. PARSE_JSON parses text that is already valid JSON. A PDF staged in Snowflake is a binary document file, not JSON text, so PARSE_JSON is not the right function. This distractor reflects the common misconception that all semi-structured ingestion starts with JSON parsing functions.
- C. Incorrect.
Incorrect. COPY INTO is used to load structured or semi-structured data into tables, but it does not automatically interpret PDF document structure into relational columns or page-based rows. AUTO_DETECT is associated with file format inference in certain loading contexts, not with document parsing of PDFs into queryable content.
- D. Incorrect.
Incorrect. While external functions can integrate with third-party services, they are not required here. The scenario explicitly asks for a built-in SQL function, and Snowflake provides PARSE_DOCUMENT for this purpose. This option is plausible because many platforms require external OCR tooling, but that is not the best answer in Snowflake for this use case.