I am trying to create a function in scala that would write a log message to delta table. example
def logMessage(message: String): Unit = {
spark.sql("INSERT INTO tablename values ('${message}')")
}
The problem is that spark.sql will return DataFrame, but in my notebook I want to execute this method in various catch blocks to log error. Obviously the return type does not match. How to write this function that would return unit and I could use it in multiple catch blocks ?