SnowPro Associate: Platform Question 69
Single answer● Run codeA data engineering team wants to execute Python code directly inside Snowflake to enrich incoming records without moving data out of the platform. They need the code to run close to the data, scale with Snowflake, and be callable from SQL as part of a transformation pipeline. Which Snowflake feature should they use?
- A
Create a Python UDF or stored procedure using Snowpark so the Python code runs within Snowflake
- B
Use SnowSQL to execute local Python scripts against Snowflake tables from a developer workstation
- C
Create an external function so Snowflake can run the Python code inside the virtual warehouse
- D
Use a user-managed EC2 instance to process the data and write the results back to Snowflake
Show answer and explanation
Correct answer: A
Explanation
For running code inside Snowflake, candidates should recognize that Snowpark-enabled Python UDFs and stored procedures are the native mechanisms for executing Python logic within the Snowflake platform. They are designed for code execution close to the data and can be integrated into SQL-driven pipelines. By contrast, SnowSQL is only a client tool, external functions execute code outside Snowflake, and user-managed compute such as EC2 is not Snowflake-native. Snowflake documentation on Snowpark, Python UDFs, and stored procedures emphasizes in-platform execution for transformations and procedural logic.
- A. Correct.
Correct. Snowflake supports running handler code such as Python within Snowflake through Snowpark-based Python UDFs and stored procedures. This lets developers execute code close to the data and invoke it from SQL, which fits the requirement to enrich records as part of a transformation pipeline without moving data out of Snowflake.
- B. Incorrect.
Incorrect. SnowSQL is a command-line client for submitting SQL statements and scripts to Snowflake. It does not provide in-platform execution of Python business logic close to the data. Running local Python scripts from a workstation would move execution outside Snowflake and does not meet the stated requirement.
- C. Incorrect.
Incorrect. External functions call out from Snowflake to remote services, typically through API Gateway and a cloud function or service. The Python code would run outside Snowflake, not inside the virtual warehouse. This is a common misconception because external functions can be invoked from SQL, but they are not used to run code natively within Snowflake.
- D. Incorrect.
Incorrect. Processing data on a user-managed EC2 instance is possible architecturally, but it moves compute and logic outside Snowflake, adds operational overhead, and does not satisfy the requirement to run code directly inside Snowflake. This option reflects a traditional ETL pattern rather than Snowflake-native code execution.