Update JdbcOutput.java for JDBC append#38
Open
GianfrancoCusmano wants to merge 2 commits intocloudera-labs:branch-0.7from
Open
Update JdbcOutput.java for JDBC append#38GianfrancoCusmano wants to merge 2 commits intocloudera-labs:branch-0.7from
GianfrancoCusmano wants to merge 2 commits intocloudera-labs:branch-0.7from
Conversation
Update JdbcOutput.java to resolve JDBC append issue.
Alternatively, to remain more in line with FileSystemOutput.java and HiveOutput.java, code can similarly be modified as per below snippet:
[...]
for (Tuple2<MutationType, Dataset<Row>> plan : planned) {
MutationType mutationType = plan._1();
Dataset<Row> mutation = plan._2();
DataFrameWriter<Row> writer = mutation.write();
switch (mutationType) {
case INSERT:
writer = writer.mode(SaveMode.Append);
writer.jdbc(url, tableName, properties);
break;
default:
throw new RuntimeException("JDBC output does not support mutation type: " + mutationType);
[...]
Author
|
Hello @jeremybeard, I am currently using Envelope for a project I am working on, and came across an issue while trying to append when using JDBC as an output, with an planner type of append. I have provided my solution as per this pull request, any feedback and review on the code change would be greatly appreciated. Best Regards, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Update JdbcOutput.java to resolve JDBC append issue.
DataFrameWriter defaults to SaveMode.ErrorIfExists, not allowing for appending to an existing table.
Explicitly set SaveMode to Append.