|
7 | 7 | from datetime import datetime |
8 | 8 | from enum import Enum |
9 | 9 |
|
10 | | -from sqlmesh.core.config import CategorizerConfig, EnvironmentSuffixTarget |
| 10 | +from sqlmesh.core.config import ( |
| 11 | + AutoCategorizationMode, |
| 12 | + CategorizerConfig, |
| 13 | + EnvironmentSuffixTarget, |
| 14 | +) |
11 | 15 | from sqlmesh.core.console import SNAPSHOT_CHANGE_CATEGORY_STR |
12 | 16 | from sqlmesh.core.context_diff import ContextDiff |
13 | 17 | from sqlmesh.core.environment import Environment, EnvironmentNamingInfo |
@@ -570,19 +574,19 @@ def _categorize_snapshots(self) -> None: |
570 | 574 | model_with_missing_columns = downstream |
571 | 575 | break |
572 | 576 |
|
| 577 | + new, old = self.context_diff.modified_snapshots[model_name] |
573 | 578 | if model_with_missing_columns is None: |
574 | | - new, old = self.context_diff.modified_snapshots[model_name] |
575 | 579 | change_category = categorize_change( |
576 | 580 | new, old, config=self.categorizer_config |
577 | 581 | ) |
578 | 582 | if change_category is not None: |
579 | 583 | self.set_choice(new, change_category) |
580 | 584 | else: |
581 | | - logger.warning( |
582 | | - "Changes to model '%s' cannot be automatically categorized due to missing schema for model '%s'", |
583 | | - model_name, |
584 | | - model_with_missing_columns, |
| 585 | + mode = self.categorizer_config.dict().get( |
| 586 | + new.model.source_type, AutoCategorizationMode.OFF |
585 | 587 | ) |
| 588 | + if mode == AutoCategorizationMode.FULL: |
| 589 | + self.set_choice(new, SnapshotChangeCategory.BREAKING) |
586 | 590 |
|
587 | 591 | # set to breaking if an indirect child has no directly modified parents |
588 | 592 | # that need a decision. this can happen when a revert to a parent causes |
|
0 commit comments