Skip to content

Commit d429ff2

Browse files
authored
Fix: Set allow_partials models for all dbt model kinds, including full refresh models (#4060)
1 parent f80b44b commit d429ff2

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

sqlmesh/dbt/model.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -556,10 +556,12 @@ def to_sqlmesh(
556556

557557
kind = self.model_kind(context)
558558
allow_partials = model_kwargs.pop("allow_partials", None)
559-
if allow_partials is None and (
560-
kind.is_incremental_unmanaged or kind.is_incremental_by_unique_key
559+
if (
560+
allow_partials is None
561+
and kind.is_materialized
562+
and not kind.is_incremental_by_time_range
561563
):
562-
# Set allow_partials to True for dbt incremental models to preserve the original semantics.
564+
# Set allow_partials to True for dbt models to preserve the original semantics.
563565
allow_partials = True
564566

565567
model = create_sql_model(

tests/dbt/test_transformation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,7 +1461,7 @@ def test_refs_in_jinja_globals(sushi_test_project: Project, mocker: MockerFixtur
14611461
}
14621462

14631463

1464-
def test_dbt_incremental_allow_partials_by_default():
1464+
def test_allow_partials_by_default():
14651465
context = DbtContext()
14661466
context._target = SnowflakeConfig(
14671467
name="target",
@@ -1481,7 +1481,7 @@ def test_dbt_incremental_allow_partials_by_default():
14811481
materialized=Materialization.TABLE.value,
14821482
)
14831483
assert model.allow_partials is None
1484-
assert not model.to_sqlmesh(context).allow_partials
1484+
assert model.to_sqlmesh(context).allow_partials
14851485

14861486
model.materialized = Materialization.INCREMENTAL.value
14871487
assert model.allow_partials is None

0 commit comments

Comments
 (0)