Skip to content

Commit 9feb219

Browse files
remove more extra vars
1 parent 685eb50 commit 9feb219

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

apps/bfd-pipeline-idr/loader.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,11 @@ def __init__(
125125
self.meta_keys_str = ", ".join(self.meta_keys)
126126
self.ordered_pkeys = model.ordered_pkeys()
127127
self.primary_keys_str = ", ".join(self.ordered_pkeys)
128-
self.update_set = [v for v in self.insert_cols if v not in model.ordered_pkeys()]
129-
self.update_set_str = ", ".join([f"{v}=EXCLUDED.{v}" for v in self.update_set])
130-
self.on_conflict_where_clause = (
131-
f"WHERE ({', '.join(f't.{v}' for v in self.update_set)}) IS "
132-
f"DISTINCT FROM ({', '.join(f'EXCLUDED.{v}' for v in self.update_set)})"
128+
update_set = [v for v in self.insert_cols if v not in self.ordered_pkeys]
129+
update_set_str = ", ".join([f"{v}=EXCLUDED.{v}" for v in update_set])
130+
on_conflict_where_clause = (
131+
f"WHERE ({', '.join(f't.{v}' for v in update_set)}) IS "
132+
f"DISTINCT FROM ({', '.join(f'EXCLUDED.{v}' for v in update_set)})"
133133
)
134134
# For immutable tables, we may still be attempting to re-load some data
135135
# due to a batch cancellation.
@@ -138,10 +138,10 @@ def __init__(
138138
# Additionally, if there are no extra columns to update, we can skip it.
139139
self.on_conflict_clause = (
140140
"DO NOTHING"
141-
if model.is_immutable() or not self.update_set
141+
if model.is_immutable() or not update_set
142142
else (
143-
f"DO UPDATE SET {self.update_set_str}, bfd_updated_ts=%(timestamp)s "
144-
f"{self.on_conflict_where_clause}"
143+
f"DO UPDATE SET {update_set_str}, bfd_updated_ts=%(timestamp)s "
144+
f"{on_conflict_where_clause}"
145145
)
146146
)
147147
# Used in _upsert so that relevant primary/last updated timestamp columns are returned for
@@ -151,7 +151,7 @@ def __init__(
151151
{
152152
col
153153
for col in [
154-
*self.model.ordered_pkeys(),
154+
*self.ordered_pkeys,
155155
self.model.last_updated_timestamp_col(),
156156
]
157157
if col

0 commit comments

Comments
 (0)