Skip to content

Commit 013f1a5

Browse files
committed
fix _replace_query_for_model now requires **kwargs & specifically "is_snapshot_deployable" for grants application.
1 parent 529c7ce commit 013f1a5

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

examples/custom_materializations/custom_materializations/custom_kind.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ def insert(
2929
) -> None:
3030
assert type(model.kind).__name__ == "ExtendedCustomKind"
3131

32-
self._replace_query_for_model(model, table_name, query_or_df, render_kwargs)
32+
self._replace_query_for_model(model, table_name, query_or_df, render_kwargs, **kwargs)

examples/custom_materializations/custom_materializations/full.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ def insert(
2020
render_kwargs: t.Dict[str, t.Any],
2121
**kwargs: t.Any,
2222
) -> None:
23-
self._replace_query_for_model(model, table_name, query_or_df, render_kwargs)
23+
self._replace_query_for_model(model, table_name, query_or_df, render_kwargs, **kwargs)

tests/core/test_integration.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2325,7 +2325,7 @@ def insert(
23252325
nonlocal custom_insert_called
23262326
custom_insert_called = True
23272327

2328-
self._replace_query_for_model(model, table_name, query_or_df, render_kwargs)
2328+
self._replace_query_for_model(model, table_name, query_or_df, render_kwargs, **kwargs)
23292329

23302330
model = context.get_model("sushi.top_waiters")
23312331
kwargs = {
@@ -2373,7 +2373,7 @@ def insert(
23732373
nonlocal custom_insert_calls
23742374
custom_insert_calls.append(model.kind.custom_property)
23752375

2376-
self._replace_query_for_model(model, table_name, query_or_df, render_kwargs)
2376+
self._replace_query_for_model(model, table_name, query_or_df, render_kwargs, **kwargs)
23772377

23782378
model = context.get_model("sushi.top_waiters")
23792379
kwargs = {
@@ -10261,14 +10261,14 @@ def test_restatement_plan_interval_external_visibility(tmp_path: Path):
1026110261
) # python model creates this file if it's in the wait loop and deletes it once done
1026210262

1026310263
# Note: to make execution block so we can test stuff, we use a Python model that blocks until it no longer detects the presence of a file
10264-
(models_dir / "model_a.py").write_text(f"""
10264+
(models_dir / "model_a.py").write_text(f"""
1026510265
from sqlmesh.core.model import model
1026610266
from sqlmesh.core.macros import MacroEvaluator
1026710267
1026810268
@model(
1026910269
"test.model_a",
1027010270
is_sql=True,
10271-
kind="FULL"
10271+
kind="FULL"
1027210272
)
1027310273
def entrypoint(evaluator: MacroEvaluator) -> str:
1027410274
from pathlib import Path
@@ -10292,7 +10292,7 @@ def entrypoint(evaluator: MacroEvaluator) -> str:
1029210292
name test.model_b,
1029310293
kind FULL
1029410294
);
10295-
10295+
1029610296
select a.m as m, 'model_b' as mb from test.model_a as a
1029710297
""")
1029810298

@@ -10322,7 +10322,7 @@ def entrypoint(evaluator: MacroEvaluator) -> str:
1032210322
name test.model_b,
1032310323
kind FULL
1032410324
);
10325-
10325+
1032610326
select a.m as m, 'model_b' as mb, 'dev' as dev_version from test.model_a as a
1032710327
""")
1032810328

@@ -10332,7 +10332,7 @@ def entrypoint(evaluator: MacroEvaluator) -> str:
1033210332
name test.model_c,
1033310333
kind FULL
1033410334
);
10335-
10335+
1033610336
select b.*, 'model_c' as mc from test.model_b as b
1033710337
""")
1033810338

@@ -10410,7 +10410,7 @@ def _run_restatement_plan(tmp_path: Path, config: Config, q: queue.Queue):
1041010410
name test.model_b,
1041110411
kind FULL
1041210412
);
10413-
10413+
1041410414
select a.m as m, 'model_b' as mb, 'dev2' as dev_version from test.model_a as a
1041510415
""")
1041610416
ctx.load()
@@ -10503,14 +10503,14 @@ def test_restatement_plan_detects_prod_deployment_during_restatement(tmp_path: P
1050310503
) # python model creates this file if it's in the wait loop and deletes it once done
1050410504

1050510505
# Note: to make execution block so we can test stuff, we use a Python model that blocks until it no longer detects the presence of a file
10506-
(models_dir / "model_a.py").write_text(f"""
10506+
(models_dir / "model_a.py").write_text(f"""
1050710507
from sqlmesh.core.model import model
1050810508
from sqlmesh.core.macros import MacroEvaluator
1050910509
1051010510
@model(
1051110511
"test.model_a",
1051210512
is_sql=True,
10513-
kind="FULL"
10513+
kind="FULL"
1051410514
)
1051510515
def entrypoint(evaluator: MacroEvaluator) -> str:
1051610516
from pathlib import Path
@@ -10552,7 +10552,7 @@ def entrypoint(evaluator: MacroEvaluator) -> str:
1055210552
name test.model_a,
1055310553
kind FULL
1055410554
);
10555-
10555+
1055610556
select 1 as changed
1055710557
""")
1055810558

0 commit comments

Comments
 (0)