Skip to content

Commit

Permalink
[hint] improve warning for typing source key columns before joining (#…
Browse files Browse the repository at this point in the history
…2117)

* [join-] improve error message for inconsistent key columns

Multiple messages are now identical and get batched into a single line.
Mention sheets names and column names instead of values.

Co-authored-by: Saul Pwanson <[email protected]>
  • Loading branch information
anjakefala and saulpw authored Nov 28, 2023
1 parent c1b30c5 commit 4a0ab56
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion visidata/features/join.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ def calcValue(self, row):
if row[c.sheet] is not None:
vals.add(c.getTypedValue(row[c.sheet]))
if len(vals) != 1:
vd.warning(f'inconsistent keys: ' + str(vals))
keycolnames = ', '.join([f'{col.sheet.name}:{col.name}' for col in self.keycols])
vd.warning(f"source key columns ({keycolnames}) have different types")
return vals.pop()

def putValue(self, row, value):
Expand Down

0 comments on commit 4a0ab56

Please sign in to comment.