Skip to content

Instantly share code, notes, and snippets.

@TRBaldim
Created December 8, 2016 11:18
Show Gist options
  • Save TRBaldim/67489cdfd25b1bc07fd61c2a618727c4 to your computer and use it in GitHub Desktop.
Save TRBaldim/67489cdfd25b1bc07fd61c2a618727c4 to your computer and use it in GitHub Desktop.
Creating partition in Spark
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