Skip to content

Commit 7fbd804

Browse files
authored
Include columns used in on expression in response (#1014)
1 parent d6c7d98 commit 7fbd804

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

web/server/api/endpoints/table_diff.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,11 @@ def get_table_diff(
5353
target_count=_row_diff.target_count,
5454
count_pct_change=_row_diff.count_pct_change,
5555
)
56-
return TableDiff(schema_diff=schema_diff, row_diff=row_diff)
56+
return TableDiff(
57+
schema_diff=schema_diff,
58+
row_diff=row_diff,
59+
on=[
60+
(eq.left, eq.right) if eq.left.table == "s" else (eq.right, eq.left)
61+
for eq in diff.on.find_all(exp.EQ)
62+
],
63+
)

web/server/models.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,3 +298,11 @@ class RowDiff(BaseModel):
298298
class TableDiff(BaseModel):
299299
schema_diff: SchemaDiff
300300
row_diff: RowDiff
301+
on: t.List[t.Tuple[str, str]]
302+
303+
@validator("on", pre=True)
304+
def validate_schema(
305+
cls,
306+
v: list[tuple[str, str]] | list[tuple[exp.Column, exp.Column]],
307+
) -> list[tuple[str, str]]:
308+
return [(str(s), str(t)) for s, t in v]

0 commit comments

Comments
 (0)