You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Sean Owen (JIRA)" <ji...@apache.org> on 2017/03/27 21:33:41 UTC

[jira] [Commented] (SPARK-20113) overwrite mode appends data on MySQL table that does not have a primary key

    [ https://issues.apache.org/jira/browse/SPARK-20113?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15944079#comment-15944079 ] 

Sean Owen commented on SPARK-20113:
-----------------------------------

If there is no primary key, how would anything know that the data is already inserted? there is no notion of sameness to decide data is already there.

> overwrite mode appends data on MySQL table that does not have a primary key
> ---------------------------------------------------------------------------
>
>                 Key: SPARK-20113
>                 URL: https://issues.apache.org/jira/browse/SPARK-20113
>             Project: Spark
>          Issue Type: Bug
>          Components: Input/Output
>    Affects Versions: 2.0.1
>            Reporter: Bhanu Akaveeti
>
> Dataframe.write in overwrite mode appends data on MySQL table that does not have a primary key
> df_mysql.write \
> .mode("overwrite") \
> .jdbc("jdbc:mysql://ip-address/database", "MySQL_Table", properties={"user": "MySQL_user", "password": "MySQL_pw"})
> When the above script is run twice, data is inserted twice. Also, I tried with option("truncate","true") but still data is appended in MySQL table



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org