Search code examples
pythondataframestored-proceduressnowflake-cloud-data-platform

Is it possible for a Snowpark stored procedure to produce a DataFrame as its output?


I want to create an snowflake stored procedure using snowpark. Inside of the procedure I will create some dataframe and performs some operations like filter, sort, join etc. At the end I just want to return that "dataframe", does snowpark supports that? Can someone provide an example of how to achieve this?


Solution

  • It is supported - Writing Snowpark Code in Python Worksheets

    1. Python Worksheet

    enter image description here

    1. Run + Deploy

    enter image description here

    1. Code is wrapped as Stored Procedure and ready to be used

    enter image description here

    1. Call in SQL

      CALL ProcName();

    enter image description here

    1. Call in Python

    enter image description here