Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 23333200D55 for ; Fri, 3 Nov 2017 16:16:07 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 21CAA160BE9; Fri, 3 Nov 2017 15:16:07 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 6F892160BFD for ; Fri, 3 Nov 2017 16:16:06 +0100 (CET) Received: (qmail 48866 invoked by uid 500); 3 Nov 2017 15:16:05 -0000 Mailing-List: contact issues-help@spark.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@spark.apache.org Received: (qmail 48783 invoked by uid 99); 3 Nov 2017 15:16:05 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Nov 2017 15:16:05 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 02B6A1A5C00 for ; Fri, 3 Nov 2017 15:16:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id nBYP7FNrv5XT for ; Fri, 3 Nov 2017 15:16:03 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 6EC8E60E74 for ; Fri, 3 Nov 2017 15:16:02 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 8F4A5E0F4E for ; Fri, 3 Nov 2017 15:16:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 08C4F241AE for ; Fri, 3 Nov 2017 15:16:01 +0000 (UTC) Date: Fri, 3 Nov 2017 15:16:01 +0000 (UTC) From: "Adrian Bridgett (JIRA)" To: issues@spark.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (SPARK-22437) jdbc write fails to set default mode MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 03 Nov 2017 15:16:07 -0000 [ https://issues.apache.org/jira/browse/SPARK-22437?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16237733#comment-16237733 ] Adrian Bridgett commented on SPARK-22437: ----------------------------------------- good grief that was fast! > jdbc write fails to set default mode > ------------------------------------ > > Key: SPARK-22437 > URL: https://issues.apache.org/jira/browse/SPARK-22437 > Project: Spark > Issue Type: Bug > Components: Java API > Affects Versions: 2.2.0 > Environment: python3 > Reporter: Adrian Bridgett > > With this bit of code: > {code} > df.write.jdbc(jdbc_url, table) > {code} > We see this error: > {code} > 09:54:22 2017-11-03 09:54:19,985 INFO File "/opt/spark220/python/lib/pyspark.zip/pyspark/sql/readwriter.py", line 820, in jdbc > 09:54:22 2017-11-03 09:54:19,985 INFO File "/opt/spark220/python/lib/py4j-0.10.4-src.zip/py4j/java_gateway.py", line 1133, in __call__ > 09:54:22 2017-11-03 09:54:19,986 INFO File "/opt/spark220/python/lib/pyspark.zip/pyspark/sql/utils.py", line 63, in deco > 09:54:22 2017-11-03 09:54:19,986 INFO File "/opt/spark220/python/lib/py4j-0.10.4-src.zip/py4j/protocol.py", line 319, in get_return_value > 09:54:22 2017-11-03 09:54:19,987 INFO py4j.protocol.Py4JJavaError: An error occurred while calling o106.jdbc. > 09:54:22 2017-11-03 09:54:19,987 INFO : scala.MatchError: null > 09:54:22 2017-11-03 09:54:19,987 INFO at org.apache.spark.sql.execution.datasources.jdbc.JdbcRelationProvider.createRelation(JdbcRelationProvider.scala:62) > 09:54:22 2017-11-03 09:54:19,987 INFO at org.apache.spark.sql.execution.datasources.DataSource.write(DataSource.scala:472) > 09:54:22 2017-11-03 09:54:19,987 INFO at org.apache.spark.sql.execution.datasources.SaveIntoDataSourceCommand.run(SaveIntoDataSourceCommand.scala:48) > ... > {code} > This seems to be that "mode" isn't correctly picking up the "error" default as listed in https://spark.apache.org/docs/latest/api/python/pyspark.sql.html#pyspark.sql.DataFrame > Note that if it was erroring because of existing data it'd say "SaveMode: ErrorIfExists." as seen in ./sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcRelationProvider.scala). > Changing our code to this worked: > {code} > df.write.jdbc(jdbc_url, table, mode='append') > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org For additional commands, e-mail: issues-help@spark.apache.org