Skip to content
This repository was archived by the owner on Mar 13, 2020. It is now read-only.

Commit 6b116cf

Browse files
author
Ben Edwards
committed
Fix syntax errors
1 parent 223a6ee commit 6b116cf

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

rdl/DestinationTableManager.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,15 @@ def upsert_table(
150150

151151
deleted_column = f"EXCLUDED.{Providers.AuditColumnsNames.IS_DELETED}"
152152
for column_config in columns_config:
153-
if "preserve_after_delete" in column_config["destination"] and column_config["destination"]["preserve_after_delete"]:
154-
existing_column = f"{target_table_name}.{column_config["destination"]["name"]}"
155-
excluded_column = f"EXCLUDED.{column_config["destination"]["name"]}"
153+
if (
154+
"preserve_after_delete" in column_config["destination"]
155+
and column_config["destination"]["preserve_after_delete"]
156+
):
157+
col_name = column_config["destination"]["name"]
158+
existing_column = f"{target_table_name}.{col_name}"
159+
excluded_column = f"EXCLUDED.{col_name}"
156160
sql_builder.write(
157-
f"{column_config["destination"]["name"]} = CASE WHEN {deleted_column} = TRUE THEN {existing_column} ELSE {excluded_column} END, \n"
161+
f"{col_name} = CASE WHEN {deleted_column} = TRUE THEN {existing_column} ELSE {excluded_column} END, \n"
158162
)
159163
else:
160164
sql_builder.write(

0 commit comments

Comments
 (0)