pyspark.sql.SparkSession.copyFromLocalToFs#

SparkSession.copyFromLocalToFs(local_path, dest_path)[source]#

Copy file from local to cloud storage file system. If the file already exits in destination path, old file is overwritten.

New in version 3.5.0.

Parameters
local_path: str

Path to a local file. Directories are not supported. The path can be either an absolute path or a relative path.

dest_path: str

The cloud storage path to the destination the file will be copied to. The path must be an an absolute path.

Notes

This API is a developer API. Also, this is an API dedicated to Spark Connect client only. With regular Spark Session, it throws an exception.