Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions sqlmesh/dbt/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,10 +556,12 @@ def to_sqlmesh(

kind = self.model_kind(context)
allow_partials = model_kwargs.pop("allow_partials", None)
if allow_partials is None and (
kind.is_incremental_unmanaged or kind.is_incremental_by_unique_key
if (
allow_partials is None
and kind.is_materialized
and not kind.is_incremental_by_time_range
):
# Set allow_partials to True for dbt incremental models to preserve the original semantics.
# Set allow_partials to True for dbt models to preserve the original semantics.
allow_partials = True

model = create_sql_model(
Expand Down
4 changes: 2 additions & 2 deletions tests/dbt/test_transformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1461,7 +1461,7 @@ def test_refs_in_jinja_globals(sushi_test_project: Project, mocker: MockerFixtur
}


def test_dbt_incremental_allow_partials_by_default():
def test_allow_partials_by_default():
context = DbtContext()
context._target = SnowflakeConfig(
name="target",
Expand All @@ -1481,7 +1481,7 @@ def test_dbt_incremental_allow_partials_by_default():
materialized=Materialization.TABLE.value,
)
assert model.allow_partials is None
assert not model.to_sqlmesh(context).allow_partials
assert model.to_sqlmesh(context).allow_partials

model.materialized = Materialization.INCREMENTAL.value
assert model.allow_partials is None
Expand Down