How to enable CDF when saveAsTable from pyspark code?

drag7ter
Contributor

I'm running this code in databricks notebook and I want the table from dataframe in catalog were created with CDF enables. When I run the code table hasn't exited yet.

This code doesn't create a table with enables CDF. It doesn't add:

delta.enableChangeDataFeed = true
 df \
.write \
.format("delta") \
.mode("overwrite") \
.option("overwriteSchema", "true") \
.option("delta.enableChangeDataFeed", "true") \
.saveAsTable(my_table_name_in_catalog): 

 Or it is possible only enable it via Spark SQL, after table already exists?