Skip to content

Commit

Permalink
[Backport 1.4.latest] convert 062_defer_state_tests (#6657)
Browse files Browse the repository at this point in the history
* convert 062_defer_state_tests (#6616)

* Fix --favor-state flag

* Convert 062_defer_state_tests

* Revert "Fix --favor-state flag"

This reverts commit ccbdcba.

* Reformat

* Revert "Revert "Fix --favor-state flag""

This reverts commit fa9d2a0.

(cherry picked from commit 07a004b)

* Add changelog entry

Co-authored-by: Jeremy Cohen <jeremy@dbtlabs.com>
  • Loading branch information
github-actions[bot] and jtcohen6 authored Jan 19, 2023
1 parent b4706c4 commit f73359b
Show file tree
Hide file tree
Showing 31 changed files with 1,141 additions and 1,122 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20230119-111101.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: Fix behavior of --favor-state with --defer
time: 2023-01-19T11:11:01.354227+01:00
custom:
Author: jtcohen6
Issue: "6617"
12 changes: 3 additions & 9 deletions core/dbt/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ def _build_snapshot_subparser(subparsers, base_subparser):
return sub


def _add_defer_argument(*subparsers):
def _add_defer_arguments(*subparsers):
for sub in subparsers:
sub.add_optional_argument_inverse(
"--defer",
Expand All @@ -499,10 +499,6 @@ def _add_defer_argument(*subparsers):
""",
default=flags.DEFER_MODE,
)


def _add_favor_state_argument(*subparsers):
for sub in subparsers:
sub.add_optional_argument_inverse(
"--favor-state",
enable_help="""
Expand Down Expand Up @@ -580,7 +576,7 @@ def _build_docs_generate_subparser(subparsers, base_subparser):
Do not run "dbt compile" as part of docs generation
""",
)
_add_defer_argument(generate_sub)
_add_defer_arguments(generate_sub)
return generate_sub


Expand Down Expand Up @@ -1192,9 +1188,7 @@ def parse_args(args, cls=DBTArgumentParser):
# list_sub sets up its own arguments.
_add_selection_arguments(run_sub, compile_sub, generate_sub, test_sub, snapshot_sub, seed_sub)
# --defer
_add_defer_argument(run_sub, test_sub, build_sub, snapshot_sub, compile_sub)
# --favor-state
_add_favor_state_argument(run_sub, test_sub, build_sub, snapshot_sub)
_add_defer_arguments(run_sub, test_sub, build_sub, snapshot_sub, compile_sub)
# --full-refresh
_add_table_mutability_arguments(run_sub, compile_sub, build_sub)

Expand Down
1 change: 1 addition & 0 deletions core/dbt/task/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def defer_to_manifest(self, adapter, selected_uids: AbstractSet[str]):
adapter=adapter,
other=deferred_manifest,
selected=selected_uids,
favor_state=bool(self.args.favor_state),
)
# TODO: is it wrong to write the manifest here? I think it's right...
self.write_manifest()

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

13 changes: 0 additions & 13 deletions test/integration/062_defer_state_tests/macros/infinite_macros.sql

This file was deleted.

3 changes: 0 additions & 3 deletions test/integration/062_defer_state_tests/macros/macros.sql

This file was deleted.

This file was deleted.

8 changes: 0 additions & 8 deletions test/integration/062_defer_state_tests/models/exposures.yml

This file was deleted.

10 changes: 0 additions & 10 deletions test/integration/062_defer_state_tests/models/schema.yml

This file was deleted.

5 changes: 0 additions & 5 deletions test/integration/062_defer_state_tests/models/table_model.sql

This file was deleted.

4 changes: 0 additions & 4 deletions test/integration/062_defer_state_tests/models/view_model.sql

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions test/integration/062_defer_state_tests/seeds/seed.csv

This file was deleted.

14 changes: 0 additions & 14 deletions test/integration/062_defer_state_tests/snapshots/my_snapshot.sql

This file was deleted.

Loading

0 comments on commit f73359b

Please sign in to comment.