Skip to content

Commit c519592

Browse files
committed
fix _replace_query_for_model now requires **kwargs & specifically "is_snapshot_deployable" for grants application.
1 parent 7e95498 commit c519592

3 files changed

Lines changed: 13 additions & 13 deletions

File tree

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
@@ -2393,7 +2393,7 @@ def insert(
23932393
nonlocal custom_insert_called
23942394
custom_insert_called = True
23952395

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

23982398
model = context.get_model("sushi.top_waiters")
23992399
kwargs = {
@@ -2441,7 +2441,7 @@ def insert(
24412441
nonlocal custom_insert_calls
24422442
custom_insert_calls.append(model.kind.custom_property)
24432443

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

24462446
model = context.get_model("sushi.top_waiters")
24472447
kwargs = {
@@ -10329,14 +10329,14 @@ def test_restatement_plan_interval_external_visibility(tmp_path: Path):
1032910329
) # python model creates this file if it's in the wait loop and deletes it once done
1033010330

1033110331
# 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
10332-
(models_dir / "model_a.py").write_text(f"""
10332+
(models_dir / "model_a.py").write_text(f"""
1033310333
from sqlmesh.core.model import model
1033410334
from sqlmesh.core.macros import MacroEvaluator
1033510335
1033610336
@model(
1033710337
"test.model_a",
1033810338
is_sql=True,
10339-
kind="FULL"
10339+
kind="FULL"
1034010340
)
1034110341
def entrypoint(evaluator: MacroEvaluator) -> str:
1034210342
from pathlib import Path
@@ -10360,7 +10360,7 @@ def entrypoint(evaluator: MacroEvaluator) -> str:
1036010360
name test.model_b,
1036110361
kind FULL
1036210362
);
10363-
10363+
1036410364
select a.m as m, 'model_b' as mb from test.model_a as a
1036510365
""")
1036610366

@@ -10390,7 +10390,7 @@ def entrypoint(evaluator: MacroEvaluator) -> str:
1039010390
name test.model_b,
1039110391
kind FULL
1039210392
);
10393-
10393+
1039410394
select a.m as m, 'model_b' as mb, 'dev' as dev_version from test.model_a as a
1039510395
""")
1039610396

@@ -10400,7 +10400,7 @@ def entrypoint(evaluator: MacroEvaluator) -> str:
1040010400
name test.model_c,
1040110401
kind FULL
1040210402
);
10403-
10403+
1040410404
select b.*, 'model_c' as mc from test.model_b as b
1040510405
""")
1040610406

@@ -10478,7 +10478,7 @@ def _run_restatement_plan(tmp_path: Path, config: Config, q: queue.Queue):
1047810478
name test.model_b,
1047910479
kind FULL
1048010480
);
10481-
10481+
1048210482
select a.m as m, 'model_b' as mb, 'dev2' as dev_version from test.model_a as a
1048310483
""")
1048410484
ctx.load()
@@ -10571,14 +10571,14 @@ def test_restatement_plan_detects_prod_deployment_during_restatement(tmp_path: P
1057110571
) # python model creates this file if it's in the wait loop and deletes it once done
1057210572

1057310573
# 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
10574-
(models_dir / "model_a.py").write_text(f"""
10574+
(models_dir / "model_a.py").write_text(f"""
1057510575
from sqlmesh.core.model import model
1057610576
from sqlmesh.core.macros import MacroEvaluator
1057710577
1057810578
@model(
1057910579
"test.model_a",
1058010580
is_sql=True,
10581-
kind="FULL"
10581+
kind="FULL"
1058210582
)
1058310583
def entrypoint(evaluator: MacroEvaluator) -> str:
1058410584
from pathlib import Path
@@ -10620,7 +10620,7 @@ def entrypoint(evaluator: MacroEvaluator) -> str:
1062010620
name test.model_a,
1062110621
kind FULL
1062210622
);
10623-
10623+
1062410624
select 1 as changed
1062510625
""")
1062610626

0 commit comments

Comments
 (0)