I've created a Hive table with a partition like this:

```
CREATE TABLE IF NOT EXISTS my_table
(uid INT, num INT) PARTITIONED BY (dt DATE)

```

Then with PySpark, I'm having a dataframe and I've tried to write it to the Hive table like this:

```
df.write.format('hive').mode('append').partitionBy('dt').saveAsTable('my_table')

```

Running this I'm getting an exception:

> 
> Dynamic partition strict mode requires at least one static partition column. To turn this off set hive.exec.dynamic.partition.mode=nonstrict
> 
> 
> 

I then added this config:

```
hive.exec.dynamic.partition=true
hive.exec.dynamic.partition.mode=nonstrict

```

This time no exception but the table wasn't populated either!

Then I removed the above config and added this:

```
hive.exec.dynamic.partition=false

```

Also altered the code to be like:

```
df.write.format('hive').mode('append').partitionBy(dt='2022-04-29').saveAsTable('my_table')

```

This time I am getting:

> 
> Dynamic partition is disabled. Either enable it by setting hive.exec.dynamic.partition=true or specify partition column values
> 
> 
> 

The Spark job I want to run is going to have daily data, so I guess what I want is the static partition, but how does it work?