Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to add DataFrame`s data to existing csv file? #64

Open
nurzhannogerbek opened this issue Apr 29, 2019 · 2 comments
Open

Comments

@nurzhannogerbek
Copy link

First of all, thank you for this wonderful library!

In remote SFTP server I have csv file with some data. Is it possible to add DataFrame's data to this existing file? In other words, previous data inside csv file should not be overwritten. I notice that the code below recreate the file.

val df: DataFrame = Seq(
	("Alex", "2018-01-01 00:00:00", "2018-02-01 00:00:00", "OUT"),
	("Bob", "2018-02-01 00:00:00", "2018-02-05 00:00:00", "IN"),
	("Kate", "2018-02-01 00:00:00", "2018-02-05 00:00:00", "IN"),
	("Alice", "2018-02-01 00:00:00", "2018-02-05 00:00:00", "OUT"),
).toDF("FIRST_NAME", "START_DATE", "END_DATE", "STATUS")

df.write.
	format("com.springml.spark.sftp").
	option("host", "XXXX").
	option("username", "XXXX").
	option("password", "****").
	option("fileType", "csv").
	option("delimiter", ";").
	save("/PATH/test.csv")
@nurzhannogerbek
Copy link
Author

I also tried such code. Unfortunately, both variant did not help me. I will be grateful for any help.

Variant A:

import org.apache.spark.sql.SaveMode

df.write.
    mode(SaveMode.Append).
    format("com.springml.spark.sftp").
    ...

Variant B:

df.write.
    mode("append").
    format("com.springml.spark.sftp")
    ...

@samuel-pt
Copy link
Contributor

@NogerbekNurzhan - This is a good feature requirement. Unfortunately we have limited time to work on it. We'll work on it when we get some time. Also if possible, add the code to support this feature and create a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants