Skip to content
Snippets Groups Projects
Commit 10d04213 authored by Michael Armbrust's avatar Michael Armbrust Committed by Matei Zaharia
Browse files

Add insertInto and saveAsTable to Python API.

Author: Michael Armbrust <michael@databricks.com>

Closes #447 from marmbrus/pythonInsert and squashes the following commits:

c7ab692 [Michael Armbrust] Keep docstrings < 72 chars.
ff62870 [Michael Armbrust] Add insertInto and saveAsTable to Python API.
parent 5d0f58b2
No related branches found
No related tags found
No related merge requests found
......@@ -305,6 +305,19 @@ class SchemaRDD(RDD):
"""
self._jschema_rdd.registerAsTable(name)
def insertInto(self, tableName, overwrite = False):
"""
Inserts the contents of this SchemaRDD into the specified table,
optionally overwriting any existing data.
"""
self._jschema_rdd.insertInto(tableName, overwrite)
def saveAsTable(self, tableName):
"""
Creates a new table with the contents of this SchemaRDD.
"""
self._jschema_rdd.saveAsTable(tableName)
def _toPython(self):
# We have to import the Row class explicitly, so that the reference Pickler has is
# pyspark.sql.Row instead of __main__.Row
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment