Skip to content

Commit 66350aa

Browse files
committed
fix _replace_query_for_model now requires **kwargs & specifically "is_snapshot_deployable" for grants application.
1 parent 1a8b917 commit 66350aa

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
@@ -2351,7 +2351,7 @@ def insert(
23512351
nonlocal custom_insert_called
23522352
custom_insert_called = True
23532353

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

23562356
model = context.get_model("sushi.top_waiters")
23572357
kwargs = {
@@ -2399,7 +2399,7 @@ def insert(
23992399
nonlocal custom_insert_calls
24002400
custom_insert_calls.append(model.kind.custom_property)
24012401

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

24042404
model = context.get_model("sushi.top_waiters")
24052405
kwargs = {
@@ -10287,14 +10287,14 @@ def test_restatement_plan_interval_external_visibility(tmp_path: Path):
1028710287
) # python model creates this file if it's in the wait loop and deletes it once done
1028810288

1028910289
# 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
10290-
(models_dir / "model_a.py").write_text(f"""
10290+
(models_dir / "model_a.py").write_text(f"""
1029110291
from sqlmesh.core.model import model
1029210292
from sqlmesh.core.macros import MacroEvaluator
1029310293
1029410294
@model(
1029510295
"test.model_a",
1029610296
is_sql=True,
10297-
kind="FULL"
10297+
kind="FULL"
1029810298
)
1029910299
def entrypoint(evaluator: MacroEvaluator) -> str:
1030010300
from pathlib import Path
@@ -10318,7 +10318,7 @@ def entrypoint(evaluator: MacroEvaluator) -> str:
1031810318
name test.model_b,
1031910319
kind FULL
1032010320
);
10321-
10321+
1032210322
select a.m as m, 'model_b' as mb from test.model_a as a
1032310323
""")
1032410324

@@ -10348,7 +10348,7 @@ def entrypoint(evaluator: MacroEvaluator) -> str:
1034810348
name test.model_b,
1034910349
kind FULL
1035010350
);
10351-
10351+
1035210352
select a.m as m, 'model_b' as mb, 'dev' as dev_version from test.model_a as a
1035310353
""")
1035410354

@@ -10358,7 +10358,7 @@ def entrypoint(evaluator: MacroEvaluator) -> str:
1035810358
name test.model_c,
1035910359
kind FULL
1036010360
);
10361-
10361+
1036210362
select b.*, 'model_c' as mc from test.model_b as b
1036310363
""")
1036410364

@@ -10436,7 +10436,7 @@ def _run_restatement_plan(tmp_path: Path, config: Config, q: queue.Queue):
1043610436
name test.model_b,
1043710437
kind FULL
1043810438
);
10439-
10439+
1044010440
select a.m as m, 'model_b' as mb, 'dev2' as dev_version from test.model_a as a
1044110441
""")
1044210442
ctx.load()
@@ -10529,14 +10529,14 @@ def test_restatement_plan_detects_prod_deployment_during_restatement(tmp_path: P
1052910529
) # python model creates this file if it's in the wait loop and deletes it once done
1053010530

1053110531
# 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
10532-
(models_dir / "model_a.py").write_text(f"""
10532+
(models_dir / "model_a.py").write_text(f"""
1053310533
from sqlmesh.core.model import model
1053410534
from sqlmesh.core.macros import MacroEvaluator
1053510535
1053610536
@model(
1053710537
"test.model_a",
1053810538
is_sql=True,
10539-
kind="FULL"
10539+
kind="FULL"
1054010540
)
1054110541
def entrypoint(evaluator: MacroEvaluator) -> str:
1054210542
from pathlib import Path
@@ -10578,7 +10578,7 @@ def entrypoint(evaluator: MacroEvaluator) -> str:
1057810578
name test.model_a,
1057910579
kind FULL
1058010580
);
10581-
10581+
1058210582
select 1 as changed
1058310583
""")
1058410584

0 commit comments

Comments
 (0)