Skip to content

Commit

Permalink
Add insertInto and saveAsTable to Python API.
Browse files Browse the repository at this point in the history
  • Loading branch information
marmbrus committed Apr 18, 2014
1 parent c399baa commit ff62870
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions python/pyspark/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,19 @@ def registerAsTable(self, name):
"""
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
Expand Down

0 comments on commit ff62870

Please sign in to comment.