ENABLE CHANGE DATA FEED FOR EXISTING DELTA-TABLE

yatharthmahesh
New Contributor III

I have a delta table already created, now I want to enable the change data feed. I read that I have to set delta.enableChangeDataFeed property to true. But however, this cannot be done using the Scala API. I tried using this but it didn't work. I am using the OS version (delta) for performing all these operations.

I really appreciate any help you can provide.

val ddl_query = """CREATE TABLE if not exists delta_training.delta_table
                   USING DELTA
                   LOCATION '/Users/data-partner-merge/src/main/resources/delta/dpm/base'
                   """
 //creation of table
 spark.sql(ddl_query)
 
 spark.sql(" ALTER TABLE delta_training.onaudience_dpm SET TBLPROPERTIES ('delta.enableChangeDataFeed' = true )").show()

 EDIT 1: As mentioned by a user, I tried using this as well, but still no changes come into action.

spark.sql(" ALTER TABLE delta_training.onaudience_dpm SET TBLPROPERTIES (delta.enableChangeDataFeed = true)")