Skip to content

Commit 9f2f9ba

Browse files
committed
fix _replace_query_for_model now requires **kwargs & specifically "is_snapshot_deployable" for grants application.
1 parent 3b7937c commit 9f2f9ba

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 = {
@@ -10385,14 +10385,14 @@ def test_restatement_plan_interval_external_visibility(tmp_path: Path):
1038510385
) # python model creates this file if it's in the wait loop and deletes it once done
1038610386

1038710387
# 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
10388-
(models_dir / "model_a.py").write_text(f"""
10388+
(models_dir / "model_a.py").write_text(f"""
1038910389
from sqlmesh.core.model import model
1039010390
from sqlmesh.core.macros import MacroEvaluator
1039110391
1039210392
@model(
1039310393
"test.model_a",
1039410394
is_sql=True,
10395-
kind="FULL"
10395+
kind="FULL"
1039610396
)
1039710397
def entrypoint(evaluator: MacroEvaluator) -> str:
1039810398
from pathlib import Path
@@ -10416,7 +10416,7 @@ def entrypoint(evaluator: MacroEvaluator) -> str:
1041610416
name test.model_b,
1041710417
kind FULL
1041810418
);
10419-
10419+
1042010420
select a.m as m, 'model_b' as mb from test.model_a as a
1042110421
""")
1042210422

@@ -10446,7 +10446,7 @@ def entrypoint(evaluator: MacroEvaluator) -> str:
1044610446
name test.model_b,
1044710447
kind FULL
1044810448
);
10449-
10449+
1045010450
select a.m as m, 'model_b' as mb, 'dev' as dev_version from test.model_a as a
1045110451
""")
1045210452

@@ -10456,7 +10456,7 @@ def entrypoint(evaluator: MacroEvaluator) -> str:
1045610456
name test.model_c,
1045710457
kind FULL
1045810458
);
10459-
10459+
1046010460
select b.*, 'model_c' as mc from test.model_b as b
1046110461
""")
1046210462

@@ -10534,7 +10534,7 @@ def _run_restatement_plan(tmp_path: Path, config: Config, q: queue.Queue):
1053410534
name test.model_b,
1053510535
kind FULL
1053610536
);
10537-
10537+
1053810538
select a.m as m, 'model_b' as mb, 'dev2' as dev_version from test.model_a as a
1053910539
""")
1054010540
ctx.load()
@@ -10627,14 +10627,14 @@ def test_restatement_plan_detects_prod_deployment_during_restatement(tmp_path: P
1062710627
) # python model creates this file if it's in the wait loop and deletes it once done
1062810628

1062910629
# 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
10630-
(models_dir / "model_a.py").write_text(f"""
10630+
(models_dir / "model_a.py").write_text(f"""
1063110631
from sqlmesh.core.model import model
1063210632
from sqlmesh.core.macros import MacroEvaluator
1063310633
1063410634
@model(
1063510635
"test.model_a",
1063610636
is_sql=True,
10637-
kind="FULL"
10637+
kind="FULL"
1063810638
)
1063910639
def entrypoint(evaluator: MacroEvaluator) -> str:
1064010640
from pathlib import Path
@@ -10676,7 +10676,7 @@ def entrypoint(evaluator: MacroEvaluator) -> str:
1067610676
name test.model_a,
1067710677
kind FULL
1067810678
);
10679-
10679+
1068010680
select 1 as changed
1068110681
""")
1068210682

0 commit comments

Comments
 (0)