Reading files with a Python stored procedure¶
Reading from stages¶
By using the SnowflakeFile class in the Snowpark snowflake.snowpark.files module, your Python handler can dynamically read a
file from either internal or external stages.
Snowflake supports reading files with SnowflakeFile for both stored procedures and user-defined functions. For more information
about reading files in your handler code, as well as more examples, refer to Reading a File with a Python UDF Handler.
Example¶
This example demonstrates how to create and call an owner’s rights stored procedure
that reads a file using the SnowflakeFile class.
Create the stored procedure with an in-line handler, specifying the input mode as binary by passing rb for the mode argument:
Call the stored procedure: