Input/Output¶

Classes

DataFrameReader(session)

Provides methods to load data in various supported formats from a Snowflake stage to a DataFrame.

DataFrameWriter(dataframe)

Provides methods for writing data from a DataFrame to supported output destinations.

FileOperation(session)

Provides methods for working on files in a stage.

PutResult(source, target, source_size, ...)

Represents the results of uploading a local file to a stage location.

GetResult(file, size, status, message)

Represents the results of downloading a file from a stage location to the local file system.

Methods

DataFrameReader.avro(path)

Specify the path of the AVRO file(s) to load.

DataFrameReader.csv(path)

Specify the path of the CSV file(s) to load.

DataFrameReader.format(format)

Specify the format of the file(s) to load.

DataFrameReader.json(path)

Specify the path of the JSON file(s) to load.

DataFrameReader.load(path)

Specify the path of the file(s) to load.

DataFrameReader.option(key, value)

Sets the specified option in the DataFrameReader.

DataFrameReader.options([configs])

Sets multiple specified options in the DataFrameReader.

DataFrameReader.orc(path)

Specify the path of the ORC file(s) to load.

DataFrameReader.parquet(path)

Specify the path of the PARQUET file(s) to load.

DataFrameReader.schema(schema)

Define the schema for CSV files that you want to read.

DataFrameReader.table(name)

Returns a Table that points to the specified table.

DataFrameReader.with_metadata(*metadata_cols)

Define the metadata columns that need to be selected from stage files.

DataFrameReader.xml(path)

Specify the path of the XML file(s) to load.

DataFrameWriter.copy_into_location()

Executes a COPY INTO <location> to unload data from a DataFrame into one or more files in a stage or external stage.

DataFrameWriter.csv(location, *[, ...])

Executes internally a COPY INTO <location> to unload data from a DataFrame into one or more CSV files in a stage or external stage.

DataFrameWriter.format(file_format_name)

Specifies the file format type to use for unloading data from the table.

DataFrameWriter.json(location, *[, ...])

Executes internally a COPY INTO <location> to unload data from a DataFrame into a JSON file in a stage or external stage.

DataFrameWriter.mode(save_mode)

Set the save mode of this DataFrameWriter.

DataFrameWriter.option(key, value)

Depending on the file_format_type specified, you can include more format specific options.

DataFrameWriter.options([configs])

Sets multiple specified options for this DataFrameWriter.

DataFrameWriter.parquet(location, *[, ...])

Executes internally a COPY INTO <location> to unload data from a DataFrame into a PARQUET file in a stage or external stage.

DataFrameWriter.save(location, *[, ...])

Executes internally a COPY INTO <location> to unload data from a DataFrame into a file in a stage or external stage.

DataFrameWriter.saveAsTable(table_name, *[, ...])

Writes the data to the specified table in a Snowflake database.

DataFrameWriter.save_as_table()

Writes the data to the specified table in a Snowflake database.

FileOperation.get(stage_location, ...[, ...])

Downloads the specified files from a path in a stage to a local directory.

FileOperation.get_stream(stage_location, *)

Downloads the specified files from a path in a stage and expose it through a stream.

FileOperation.put(local_file_name, ...[, ...])

Uploads local files to the stage.

FileOperation.put_stream(input_stream, ...)

Uploads local files to the stage via a file stream.

PutResult.count(value, /)

Return number of occurrences of value.

PutResult.index(value[, start, stop])

Return first index of value.

GetResult.count(value, /)

Return number of occurrences of value.

GetResult.index(value[, start, stop])

Return first index of value.

Attributes

PutResult.message

The detailed message of the upload status.

PutResult.source

The source file path.

PutResult.source_compression

The source file compression format.

PutResult.source_size

The size in bytes of the source file.

PutResult.status

Status indicating whether the file was uploaded to the stage.

PutResult.target

The file path in the stage where the source file is uploaded.

PutResult.target_compression

The target file compression format.

PutResult.target_size

The size in bytes of the target file.

GetResult.file

The downloaded file path.

GetResult.message

The detailed message about the download status.

GetResult.size

The size in bytes of the downloaded file.

GetResult.status

Indicates whether the download is successful.