You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Kapil Raaj <ca...@gmail.com> on 2015/10/04 16:19:51 UTC

Enriching df.write.jdbc

Hello folks,

I would like to contribute code to enrich DataFrame writer api for JDBC to
cover "Update table" feature based on some field name/key passed as LIST of
Strings.

Use Case:
1. df.write.mode(*"Update"*).jdbc(connectionString, "table_name"
,connectionProperties, *keys*)
Or
2. df.write.mode(SaveMode.Append).jdbc(connectionString, "table_name"
,connectionProperties, *keys*)

For the second implementation if "keys" is an empty list it'll work as it
is working for now, if "keys" have something, it'll update those entries.

 Let me know which (1 or 2) is better, I think 2 looks better as I don't
want to introduce a new ENUM for SaveMode, moreover "update" looks
irrelevant in context of Big data transformation.

If this use case is useful, let me know I'll go ahead and send a PR.
Any other tips will highly be appreciated.

thanks,

-- 
kapil