Skip to content

Commit 45dbbbc

Browse files
committed
Widen types instead of casting
1 parent 8df9c29 commit 45dbbbc

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

sqlmesh/core/context.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,10 +1860,10 @@ def table_diff(
18601860
self,
18611861
source: str,
18621862
target: str,
1863-
on: t.Optional[t.List[str] | exp.Condition] = None,
1863+
on: t.Optional[t.List[str] | exp.Expr] = None,
18641864
skip_columns: t.Optional[t.List[str]] = None,
18651865
select_models: t.Optional[t.Collection[str]] = None,
1866-
where: t.Optional[str | exp.Condition] = None,
1866+
where: t.Optional[str | exp.Expr] = None,
18671867
limit: int = 20,
18681868
show: bool = True,
18691869
show_sample: bool = True,
@@ -1922,7 +1922,7 @@ def table_diff(
19221922
raise SQLMeshError(e)
19231923

19241924
models_to_diff: t.List[
1925-
t.Tuple[Model, EngineAdapter, str, str, t.Optional[t.List[str] | exp.Condition]]
1925+
t.Tuple[Model, EngineAdapter, str, str, t.Optional[t.List[str] | exp.Expr]]
19261926
] = []
19271927
models_without_grain: t.List[Model] = []
19281928
source_snapshots_to_name = {
@@ -2041,9 +2041,9 @@ def _model_diff(
20412041
target_alias: str,
20422042
limit: int,
20432043
decimals: int,
2044-
on: t.Optional[t.List[str] | exp.Condition] = None,
2044+
on: t.Optional[t.List[str] | exp.Expr] = None,
20452045
skip_columns: t.Optional[t.List[str]] = None,
2046-
where: t.Optional[str | exp.Condition] = None,
2046+
where: t.Optional[str | exp.Expr] = None,
20472047
show: bool = True,
20482048
temp_schema: t.Optional[str] = None,
20492049
skip_grain_check: bool = False,
@@ -2083,10 +2083,10 @@ def _table_diff(
20832083
limit: int,
20842084
decimals: int,
20852085
adapter: EngineAdapter,
2086-
on: t.Optional[t.List[str] | exp.Condition] = None,
2086+
on: t.Optional[t.List[str] | exp.Expr] = None,
20872087
model: t.Optional[Model] = None,
20882088
skip_columns: t.Optional[t.List[str]] = None,
2089-
where: t.Optional[str | exp.Condition] = None,
2089+
where: t.Optional[str | exp.Expr] = None,
20902090
schema_diff_ignore_case: bool = False,
20912091
) -> TableDiff:
20922092
if not on:

sqlmesh/core/table_diff.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,9 @@ def __init__(
224224
adapter: EngineAdapter,
225225
source: TableName,
226226
target: TableName,
227-
on: t.List[str] | exp.Condition,
227+
on: t.List[str] | exp.Expr,
228228
skip_columns: t.List[str] | None = None,
229-
where: t.Optional[str | exp.Condition] = None,
229+
where: t.Optional[str | exp.Expr] = None,
230230
limit: int = 20,
231231
source_alias: t.Optional[str] = None,
232232
target_alias: t.Optional[str] = None,

sqlmesh/lsp/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ def _custom_api(
374374
table_diffs = context.context.table_diff(
375375
source=source,
376376
target=target,
377-
on=t.cast(exp.Condition, exp.condition(on)) if on else None,
377+
on=exp.condition(on) if on else None,
378378
select_models={model_or_snapshot} if model_or_snapshot else None,
379379
where=where,
380380
limit=limit,

0 commit comments

Comments
 (0)