title: Inserting data into a static Hive partition using Spark SQL
body: <p>I have trouble figuring out how to insert data into a static partition of a Hive table using Spark SQL. I can use code like this to write into dynamic partitions:</p>
  
  <pre><code>df.write.partitionBy("key").insertInto("my_table")
  </code></pre>
  
  <p>However, I can't figure out how to insert the data into a static partition. That means, I want to define the partition where the entire DataFrame should be written without the need to add the column to the DataFrame.</p>
  
  <p>I see static partitioning mentioned in the 
  <a href="https://github.com/apache/spark/blob/master/sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/InsertIntoHiveTable.scala#L164" rel="noreferrer">InsertIntoHiveTable</a> class, so I guess it is supported. Is there a public API to do what I want?</p>