I'm dealing with CSV files hosted in an SFTP. I can access them using pd.read_csv() but this is not working with spark.read.csv(). I'd like to understand why.
ssh.connect(host_name, username=username, password=password, pkey=pk)
ftp_client = ssh.open_sftp()
# reading csv
path = 'some_path'
files = ftp_client.listdir('{}'.format(path))
for file in files:
with ftp_client.open('{}/{}'.format(path, file)) as f:
# this is not working
# df = spark.read.csv(f)
# this is working
df = pd.read_csv(f)
print(df)
When running this command with spark read CSV method I have following error path can be only string, list or RDD