Github user davies commented on a diff in the pull request: https://github.com/apache/spark/pull/4446#discussion_r24461632 --- Diff: python/pyspark/sql/dataframe.py --- @@ -146,9 +146,74 @@ def insertInto(self, tableName, overwrite=False): """ self._jdf.insertInto(tableName, overwrite) - def saveAsTable(self, tableName): - """Creates a new table with the contents of this DataFrame.""" - self._jdf.saveAsTable(tableName) + def _java_save_mode(self, mode): + """Returns the Java save mode based on the Python save mode represented by a string. + """ + jmode = self._sc._jvm.org.apache.spark.sql.sources.SaveMode.ErrorIfExists + mode = mode.lower() + if mode == "append": + jmode = self._sc._jvm.org.apache.spark.sql.sources.SaveMode.Append + elif mode == "overwrite": + jmode = self._sc._jvm.org.apache.spark.sql.sources.SaveMode.Overwrite + elif mode == "ignore": + jmode = self._sc._jvm.org.apache.spark.sql.sources.SaveMode.Ignore + elif mode == "error": + pass + else: + raise ValueError( + "Only 'append', 'overwrite', 'ignore', and 'error' are acceptable save mode.") + return jmode + + def saveAsTable(self, tableName, source=None, mode="append", **options): --- End diff -- I think `tableName` could be just `name`.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org