snowflakedb / snowflakedb/snowpark-python
SNOW-1454377: Snowflake Native Apps Stored Procedure fails to execute or return table when called from Task
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 341
- Forks
- 155
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 27
Description
-
What version of Python are you using?
Python 3.11
-
What operating system and processor architecture are you using?
The environment of the Stored Procedure implemented within the Snowflake Native Apps
-
What are the component versions in the environment (
pip freeze)?The Stored Procedure is executed within a Snowflake Native App environment. The specific versions of the installed packages are not directly accessible within the Native App context.
-
What did you do?
I am attempting to execute a Stored Procedure implemented within a Snowflake Native App via a Snowpark Python Task. The Stored Procedure is designed to return a table, but it fails to execute when called from the Task.
Steps to Reproduce:
- Create a Snowflake Native App containing a Stored Procedure that returns a table.
- Implement Task that calls the Stored Procedure.
- Execute the Task.
-
What did you expect to see?
I expected the Task to successfully call the Stored Procedure and retrieve the resulting table.
What happened instead?
The Task fails with an error indicating that the Stored Procedure could not be executed. Additionally, attempting to retrieve the results using
result_scanfails, suggesting that the SYSTEM user (used by Tasks) does not have permission to access the results within the Native App context.
It seems that the execution of the procedure is failing when trying to run the following code:
- Can you set logging to DEBUG and collect the logs?
Additional Information:
- This issue appears to be a bug specific to the interaction between Tasks and Native Apps when Stored Procedures return tables.
- The Stored Procedure functions correctly and returns the expected table when called directly (outside of a Task).
Request:
Please investigate and resolve this issue to enable the successful execution of Stored Procedures within Snowflake Native Apps when called from Snowpark Tasks, especially when those procedures return tables. Additionally, please address the permissions issue related to result retrieval to ensure seamless integration between these components.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/snowflake/snowpark/_internal/server_connection.py around line 452, then reproduce the reported flow: a Snowflake Native App stored procedure returning a table called from a Snowpark Python Task. Compare direct procedure execution with Task execution and the result_scan attempt. Done means the Task can execute the procedure, retrieve its table result, and avoid the reported SYSTEM-user permission failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-engineering
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100