Skip to content

Commit 39453b6

Browse files
authored
Chore: Rename --promote-all to --include-unmodified (#1166)
1 parent 4951ff9 commit 39453b6

File tree

22 files changed

+51
-49
lines changed

22 files changed

+51
-49
lines changed

docs/reference/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ See [Airflow Integration Guide](../integrations/airflow.md) for information on h
149149
| `snapshot_ttl` | The period of time that a model snapshot not a part of any environment should exist before being deleted. This is defined as a string with the default `in 1 week`. Other [relative dates](https://dateparser.readthedocs.io/en/latest/) can be used, such as `in 30 days`. (Default: `in 1 week`) | string | N |
150150
| `environment_ttl` | The period of time that a development environment should exist before being deleted. This is defined as a string with the default `in 1 week`. Other [relative dates](https://dateparser.readthedocs.io/en/latest/) can be used, such as `in 30 days`. (Default: `in 1 week`) | string | N |
151151
| `pinned_environments` | The list of development environments that are exempt from deletion due to expiration | list[string] | N |
152-
| `promote_all` | Indicates whether to create views for all models in the target development environment or only for modified ones | boolean | N |
152+
| `include_unmodified` | Indicates whether to create views for all models in the target development environment or only for modified ones | boolean | N |
153153
| `ignore_patterns` | Files that match glob patterns specified in this list are ignored when scanning the project folder (Default: `[]`) | list[string] | N |
154154
| `time_column_format` | The default format to use for all model time columns. This time format uses [python format codes](https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes) (Default: `%Y-%m-%d`) | string | N |
155155
| `auto_categorize_changes` | Indicates whether SQLMesh should attempt to automatically [categorize](../concepts/plans.md#change-categories) model changes during plan creation per each model source type ([Additional Details](#auto-categorize-changes)) | dict[string, string] | N |

sqlmesh/cli/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,9 @@ def diff(ctx: click.Context, environment: t.Optional[str] = None) -> None:
267267
default=None,
268268
)
269269
@click.option(
270-
"--promote-all",
270+
"--include-unmodified",
271271
is_flag=True,
272-
help="Promote all models in the target environment as opposed to only modified ones.",
272+
help="Include unmodified models in the target environment.",
273273
default=None,
274274
)
275275
@click.pass_context

sqlmesh/core/config/root.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class Config(BaseConfig):
3939
users: A list of users that can be used for approvals/notifications.
4040
pinned_environments: A list of development environment names that should not be deleted by the janitor task.
4141
model_defaults: Default values for model definitions.
42-
promote_all: Indicates whether to promote all models in the target development environment or only modified ones.
42+
include_unmodified: Indicates whether to include unmodified models in the target development environment.
4343
"""
4444

4545
gateways: t.Union[t.Dict[str, GatewayConfig], GatewayConfig] = GatewayConfig()
@@ -60,7 +60,7 @@ class Config(BaseConfig):
6060
loader: t.Type[Loader] = SqlMeshLoader
6161
env_vars: t.Dict[str, str] = {}
6262
username: str = ""
63-
promote_all: bool = False
63+
include_unmodified: bool = False
6464

6565
_FIELD_UPDATE_STRATEGY: t.ClassVar[t.Dict[str, UpdateStrategy]] = {
6666
"gateways": UpdateStrategy.KEY_UPDATE,

sqlmesh/core/context.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ def plan(
683683
auto_apply: bool = False,
684684
no_auto_categorization: t.Optional[bool] = None,
685685
effective_from: t.Optional[TimeLike] = None,
686-
promote_all: t.Optional[bool] = None,
686+
include_unmodified: t.Optional[bool] = None,
687687
) -> Plan:
688688
"""Interactively create a migration plan.
689689
@@ -717,7 +717,7 @@ def plan(
717717
changes (breaking / non-breaking). If not provided, then the corresponding configuration
718718
option determines the behavior.
719719
effective_from: The effective date from which to apply forward-only changes on production.
720-
promote_all: Indicates whether to promote all models in the target development environment or only modified ones.
720+
include_unmodified: Indicates whether to include unmodified models in the target development environment.
721721
722722
Returns:
723723
The populated Plan object.
@@ -736,8 +736,8 @@ def plan(
736736
self.environment_ttl if environment not in self.pinned_environments else None
737737
)
738738

739-
if promote_all is None:
740-
promote_all = self.config.promote_all
739+
if include_unmodified is None:
740+
include_unmodified = self.config.include_unmodified
741741

742742
plan = Plan(
743743
context_diff=self._context_diff(environment or c.PROD, create_from=create_from),
@@ -754,7 +754,7 @@ def plan(
754754
categorizer_config=self.auto_categorize_changes,
755755
auto_categorization_enabled=not no_auto_categorization,
756756
effective_from=effective_from,
757-
promote_all=promote_all,
757+
include_unmodified=include_unmodified,
758758
)
759759

760760
if not no_prompts:

sqlmesh/core/plan/definition.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class Plan:
6363
categorizer_config: Auto categorization settings.
6464
auto_categorization_enabled: Whether to apply auto categorization.
6565
effective_from: The effective date from which to apply forward-only changes on production.
66-
promote_all: Indicates whether to promote all models in the target development environment or only modified ones.
66+
include_unmodified: Indicates whether to include unmodified models in the target development environment.
6767
"""
6868

6969
def __init__(
@@ -82,7 +82,7 @@ def __init__(
8282
categorizer_config: t.Optional[CategorizerConfig] = None,
8383
auto_categorization_enabled: bool = True,
8484
effective_from: t.Optional[TimeLike] = None,
85-
promote_all: bool = False,
85+
include_unmodified: bool = False,
8686
):
8787
self.context_diff = context_diff
8888
self.override_start = start is not None
@@ -95,7 +95,7 @@ def __init__(
9595
self.environment_ttl = environment_ttl
9696
self.categorizer_config = categorizer_config or CategorizerConfig()
9797
self.auto_categorization_enabled = auto_categorization_enabled
98-
self.promote_all = promote_all
98+
self.include_unmodified = include_unmodified
9999
self._effective_from: t.Optional[TimeLike] = None
100100
self._start = start if start or not (is_dev and forward_only) else yesterday_ds()
101101
self._end = end if end or not is_dev else now()
@@ -269,7 +269,7 @@ def environment(self) -> Environment:
269269

270270
snapshots = [s.table_info for s in self.snapshots]
271271
promoted_snapshot_ids = None
272-
if self.is_dev and not self.promote_all:
272+
if self.is_dev and not self.include_unmodified:
273273
promoted_snapshot_ids = [
274274
s.snapshot_id for s in snapshots if s.name in self.context_diff.promotable_models
275275
]
@@ -628,12 +628,12 @@ def _ensure_forward_only_models_compatibility(self) -> None:
628628
def _ensure_new_env_with_changes(self) -> None:
629629
if (
630630
self.is_dev
631-
and not self.promote_all
631+
and not self.include_unmodified
632632
and self.context_diff.is_new_environment
633633
and not self.context_diff.has_snapshot_changes
634634
):
635635
raise NoChangesPlanError(
636-
"No changes were detected. Make a change or run with --promote-all to create a new environment without changes."
636+
"No changes were detected. Make a change or run with --include-unmodified to create a new environment without changes."
637637
)
638638

639639

sqlmesh/magics.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,9 @@ def test(self, line: str, test_def_raw: t.Optional[str] = None) -> None:
292292
default=None,
293293
)
294294
@argument(
295-
"--promote-all",
295+
"--include-unmodified",
296296
action="store_true",
297-
help="Promote all models in the target environment as opposed to only modified ones.",
297+
help="Include unmodified models in the target environment.",
298298
default=None,
299299
)
300300
@line_magic
@@ -322,7 +322,7 @@ def plan(self, line: str) -> None:
322322
auto_apply=args.auto_apply,
323323
no_auto_categorization=args.no_auto_categorization,
324324
effective_from=args.effective_from,
325-
promote_all=args.promote_all,
325+
include_unmodified=args.include_unmodified,
326326
)
327327
self._context.console = console
328328

tests/core/test_context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ def test_plan_apply(sushi_context) -> None:
287287
"dev",
288288
start=yesterday_ds(),
289289
end=yesterday_ds(),
290-
promote_all=True,
290+
include_unmodified=True,
291291
)
292292
sushi_context.apply(plan)
293293
assert sushi_context.state_reader.get_environment("dev")

tests/core/test_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ def apply_to_environment(
735735
environment,
736736
forward_only=choice == SnapshotChangeCategory.FORWARD_ONLY,
737737
no_prompts=True,
738-
promote_all=True,
738+
include_unmodified=True,
739739
)
740740
plan.set_start(start(context))
741741

tests/core/test_plan.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,9 @@ def test_new_environment_no_changes(make_snapshot, mocker: MockerFixture):
506506

507507
assert Plan(context_diff_mock).environment.promoted_snapshot_ids is None
508508
assert (
509-
Plan(context_diff_mock, is_dev=True, promote_all=True).environment.promoted_snapshot_ids
509+
Plan(
510+
context_diff_mock, is_dev=True, include_unmodified=True
511+
).environment.promoted_snapshot_ids
510512
is None
511513
)
512514

tests/core/test_plan_evaluator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def sushi_plan(sushi_context: Context, mocker: MockerFixture) -> Plan:
1818
return Plan(
1919
sushi_context._context_diff("dev"),
2020
is_dev=True,
21-
promote_all=True,
21+
include_unmodified=True,
2222
)
2323

2424

0 commit comments

Comments
 (0)