Created
December 8, 2016 11:18
-
-
Save TRBaldim/67489cdfd25b1bc07fd61c2a618727c4 to your computer and use it in GitHub Desktop.
Creating partition in Spark
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
hive_context.setConf("spark.sql.hive.convertMetastoreOrc", "false") | |
hive_context.setConf("hive.exec.dynamic.partition", "true") | |
hive_context.setConf("hive.exec.dynamic.partition.mode", "nonstrict") | |
my_df.select(*[col(c).alias(c) for c in columns])\ | |
.write.mode("append")\ | |
.partitionBy('year-month')\ | |
.insertInto("my_table_patitioned") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment