'For loop on dataframe to delete
I am new to spark and azure. I have saved the result of a dataframe in a temp table using databricks. I have a similar table (same structure) in postgres database. Now, I want to delete the rows in postgres table which has the same column value as in temp table (WHERE temp_table.column2 = postgres_table.column2). For this I want to iterate through the rows of that temp table using FOR loop and DELETE the matching rows from postgres table.
Example:
For rows in temp table sample_table ->
WHEN sample_table.column_name = postgres_table.column_name
THEN DELETE postgres_table.column_name;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|