You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Python 3.8 needs to use typing.Iterable because collections.abc.Iterable is not subscriptable
21
19
# Python 3.9 can use both
22
20
# Python 3.10 needs to use collections.abc.Iterable because typing.Iterable is removed
@@ -34,7 +32,7 @@ class SnowflakeFile(RawIOBase):
34
32
SnowflakeFile supports most operations supported by Python IOBase objects.
35
33
A SnowflakeFile object can be used as a Python IOBase object.
36
34
37
-
The constructor of this class is not supposed to be called directly. Call :meth:`~snowflake.snowpark.file.SnowflakeFile.open` to create a SnowflakeFile object.
35
+
The constructor of this class is not supposed to be called directly. Call :meth:`~snowflake.snowpark.file.SnowflakeFile.open` to create a read-only SnowflakeFile object, and call :meth:`~snowflake.snowpark.file.SnowflakeFile.open_new_result` to create a write-only SnowflakeFile object.
38
36
39
37
This class is intended for usage within UDFs and stored procedures and many methods do not work locally.
40
38
"""
@@ -73,26 +71,39 @@ def open(
73
71
require_scoped_url: bool=True,
74
72
) ->SnowflakeFile:
75
73
"""
76
-
Returns a :class:`~snowflake.snowpark.file.SnowflakeFile`.
77
-
In UDF and Stored Procedures, the object works like a Python IOBase object and as a wrapper for an IO stream of remote files. The IO Stream is to support the file operations defined in this class.
74
+
Used to create a :class:`~snowflake.snowpark.file.SnowflakeFile` which can only be used for read-based IO operations on the file.
75
+
76
+
In UDFs and Stored Procedures, the object works like a read-only Python IOBase object and as a wrapper for an IO stream of remote files.
78
77
79
78
All files are accessed in the context of the UDF owner (with the exception of caller's rights stored procedures which use the caller's context).
80
79
UDF callers should use scoped URLs to allow the UDF to access their files. By accepting only scoped URLs the UDF owner can ensure
81
-
the UDF caller had access to the provided file. Removing the requirement that the URL is a scoped URL (require_scoped_url=false) allows the caller
80
+
the UDF caller had access to the provided file. Removing the requirement that the URL is a scoped URL (require_scoped_url=False) allows the caller
82
81
to provide URLs that may be only accessible by the UDF owner.
83
82
84
83
is_owner_file is marked for deprecation. For Snowflake release 7.8 and onwards please use require_scoped_url instead.
85
84
86
85
Args:
87
86
file_location: scoped URL, file URL, or string path for files located in a stage
88
-
mode: A string used to mark the type of an IO stream.
87
+
mode: A string used to mark the type of an IO stream. Supported modes are "r" for text read and "rb" for binary read.
89
88
is_owner_file: (Deprecated) A boolean value, if True, the API is intended to access owner's files and all URI/URL are allowed. If False, the API is intended to access files passed into the function by the caller and only scoped URL is allowed.
90
89
require_scoped_url: A boolean value, if True, file_location must be a scoped URL. A scoped URL ensures that the caller cannot access the UDF owners files that the caller does not have access to.
Used to create a :class:`~snowflake.snowpark.file.SnowflakeFile` which can only be used for write-based IO operations. UDFs/Stored Procedures should return the file to materialize it, and it is then made accessible via a scoped URL returned in the query results.
99
+
100
+
In UDFs and Stored Procedures, the object works like a write-only Python IOBase object and as a wrapper for an IO stream of remote files.
101
+
102
+
Args:
103
+
mode: A string used to mark the type of an IO stream. Supported modes are "w" for text write and "wb" for binary write.
Returns a :class:`~snowflake.snowpark.file.SnowflakeFile`.
133
-
In UDF and Stored Procedures, the object works like a Python IOBase object and as a wrapper for an IO stream of remote files. The IO Stream is to support the file operations defined in this class.
134
-
135
-
This stream will open a writable result file that will be materialized when it's returned by a UDF or Stored Procedure. When the file is materialized then file_uri will be set to a scoped URL that temporarily references this file.
136
-
137
-
Args:
138
-
mode: A string used to mark the type of an IO stream.
0 commit comments