Skip to content

Commit db580fc

Browse files
committed
feedback
1 parent b477bcd commit db580fc

1 file changed

Lines changed: 6 additions & 15 deletions

File tree

sqlmesh/dbt/model.py

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -243,17 +243,6 @@ def snapshot_strategy(self) -> t.Optional[SnapshotStrategy]:
243243
def table_schema(self) -> str:
244244
return self.target_schema or super().table_schema
245245

246-
def _get_overlapping_field_value(
247-
self, context: DbtContext, dbt_field_name: str, sqlmesh_field_name: str
248-
) -> t.Optional[t.Any]:
249-
dbt_field = self._get_field_value(dbt_field_name)
250-
sqlmesh_field = getattr(self, sqlmesh_field_name, None)
251-
if dbt_field is not None and sqlmesh_field is not None:
252-
get_console().log_warning(
253-
f"Both '{dbt_field_name}' and '{sqlmesh_field_name}' are set for model '{self.canonical_name(context)}'. '{sqlmesh_field_name}' will be used."
254-
)
255-
return sqlmesh_field if sqlmesh_field is not None else dbt_field
256-
257246
def model_kind(self, context: DbtContext) -> ModelKind:
258247
"""
259248
Get the sqlmesh ModelKind
@@ -342,16 +331,18 @@ def model_kind(self, context: DbtContext) -> ModelKind:
342331
f"Supported strategies include {collection_to_str(INCREMENTAL_BY_TIME_RANGE_STRATEGIES)}."
343332
)
344333

345-
if self.time_column and strategy not in {"incremental_by_time_range", "microbatch"}:
334+
if self.time_column and strategy != "incremental_by_time_range":
346335
get_console().log_warning(
347336
f"Using `time_column` on a model with incremental_strategy '{strategy}' has been deprecated. "
348337
f"Please use `incremental_by_time_range` instead in model '{self.canonical_name(context)}'."
349338
)
350339

351340
if strategy == "microbatch":
352-
time_column = self._get_overlapping_field_value(
353-
context, "event_time", "time_column"
354-
)
341+
if self.time_column:
342+
raise ConfigError(
343+
f"{self.canonical_name(context)}: 'time_column' cannot be used with 'microbatch' incremental strategy. Use 'event_time' instead."
344+
)
345+
time_column = self._get_field_value("event_time")
355346
if not time_column:
356347
raise ConfigError(
357348
f"{self.canonical_name(context)}: 'event_time' is required for microbatch incremental strategy."

0 commit comments

Comments
 (0)