Last active
June 10, 2016 19:30
-
-
Save robenalt/eea9085dbfe6c061db44b4d06d85b333 to your computer and use it in GitHub Desktop.
pyspark save dataframe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#from pyspark.sql import HiveContext | |
#sqlContext = HiveContext(sc) | |
query = """ | |
select * from db.sometable where col>50 | |
""" | |
results = sqlContext.sql(query) | |
result_writer = pyspark.sql.DataFrameWriter(results) | |
result_writer.saveAsTable('db.new_table_name',format='parquet', mode='overwrite',path='/path/to/new/data/files') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment