cgrant
Databricks Employee
Databricks Employee

If you are deleting from a Delta Lake table, a more scalable strategy would be to write your records_to_delete_df to a table, and then use the MERGE command to delete where you have matches.

MERGE INTO {target_table} target
USING records_to_delete source
ON source.{col} = target.{col} -- add more columns here, AND them together
WHEN MATCHED THEN DELETE 

If you're instead deleting from Postgres, you'd use the same strategy, the syntax would likely be a bit different