snowflake.snowpark.files.SnowflakeFile

class snowflake.snowpark.files.SnowflakeFile(file_location: str, mode: str = 'r', is_owner_file: bool = False, *, require_scoped_url: bool = True, from_result_api: bool = False)[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.32.0/src/snowflake/snowpark/files.py#L29-L227)

Bases: RawIOBase

SnowflakeFile provides an interface to operate on files as Python IOBase-like objects in UDFs and stored procedures. SnowflakeFile supports most operations supported by Python IOBase objects. A SnowflakeFile object can be used as a Python IOBase object.

The constructor of this class is not supposed to be called directly. Call open() to create a read-only SnowflakeFile object, and call open_new_result() to create a write-only SnowflakeFile object.

This class is intended for usage within UDFs and stored procedures and many methods do not work locally.

Methods

close()

In UDF and Stored Procedures, the close func closes the IO Stream included in the SnowflakeFile.

detach()

Not yet supported in UDF and Stored Procedures.

fileno()

See https://docs.python.org/3/library/io.html#io.IOBase.fileno (https://docs.python.org/3/library/io.html#io.IOBase.fileno)

flush()

Not yet supported in UDF and Stored Procedures.

isatty()

Returns False, file streams in stored procedures and UDFs are never interactive in Snowflake.

open(file_location[, mode, is_owner_file, ...])

Used to create a SnowflakeFile which can only be used for read-based IO operations on the file.

open_new_result([mode])

Used to create a SnowflakeFile which can only be used for write-based IO operations.

read([size])

See https://docs.python.org/3/library/io.html#io.RawIOBase.read (https://docs.python.org/3/library/io.html#io.RawIOBase.read)

read1([size])

See https://docs.python.org/3/library/io.html#io.BufferedIOBase.read1 (https://docs.python.org/3/library/io.html#io.BufferedIOBase.read1)

readable()

See https://docs.python.org/3/library/io.html#io.IOBase.readable (https://docs.python.org/3/library/io.html#io.IOBase.readable)

readall()

See https://docs.python.org/3/library/io.html#io.RawIOBase.readall (https://docs.python.org/3/library/io.html#io.RawIOBase.readall)

readinto(b)

See https://docs.python.org/3/library/io.html#io.IOBase.readinto (https://docs.python.org/3/library/io.html#io.IOBase.readinto)

readinto1(b)

See https://docs.python.org/3/library/io.html#io.BufferedIOBase.readinto1 (https://docs.python.org/3/library/io.html#io.BufferedIOBase.readinto1)

readline([size])

See https://docs.python.org/3/library/io.html#io.IOBase.readline (https://docs.python.org/3/library/io.html#io.IOBase.readline)

readlines([hint])

See https://docs.python.org/3/library/io.html#io.IOBase.readlines (https://docs.python.org/3/library/io.html#io.IOBase.readlines)

seek(offset[, whence])

See https://docs.python.org/3/library/io.html#io.IOBase.seek (https://docs.python.org/3/library/io.html#io.IOBase.seek)

seekable()

See https://docs.python.org/3/library/io.html#io.IOBase.seekable (https://docs.python.org/3/library/io.html#io.IOBase.seekable)

tell()

See https://docs.python.org/3/library/io.html#io.IOBase.tell (https://docs.python.org/3/library/io.html#io.IOBase.tell)

truncate([size])

Not yet supported in UDF and Stored Procedures.

writable()

See https://docs.python.org/3/library/io.html#io.IOBase.writable (https://docs.python.org/3/library/io.html#io.IOBase.writable)

write(b)

See https://docs.python.org/3/library/io.html#io.RawIOBase.write (https://docs.python.org/3/library/io.html#io.RawIOBase.write)

writelines(lines)

See https://docs.python.org/3/library/io.html#io.IOBase.writelines (https://docs.python.org/3/library/io.html#io.IOBase.writelines)

Attributes

Language: English