Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CT-1804] Add --favor-state as param in click CLI #6585

Closed
Tracked by #5527 ...
jtcohen6 opened this issue Jan 11, 2023 · 1 comment
Closed
Tracked by #5527 ...

[CT-1804] Add --favor-state as param in click CLI #6585

jtcohen6 opened this issue Jan 11, 2023 · 1 comment
Assignees
Labels
cli python_api Issues related to dbtRunner Python entry point

Comments

@jtcohen6
Copy link
Contributor

Context: #5859 (comment)

@jtcohen6 jtcohen6 added python_api Issues related to dbtRunner Python entry point cli Team:Execution labels Jan 11, 2023
@github-actions github-actions bot changed the title Add --favor-state as param in click CLI [CT-1804] Add --favor-state as param in click CLI Jan 11, 2023
@jtcohen6
Copy link
Contributor Author

Copying from #6617

[Tech debt] Inconsistent implementation

Also, the way --favor-state was implemented is parallel to --defer, but different from most of our other flags since v1.0:

dbt-core/core/dbt/flags.py

Lines 117 to 118 in 20c95a4

DEFER_MODE = env_set_truthy("DBT_DEFER_TO_STATE")
FAVOR_STATE_MODE = env_set_truthy("DBT_FAVOR_STATE")

(Namely, the argparse default is set based on the flag, rather than the other way around!)

dbt-core/core/dbt/main.py

Lines 504 to 515 in 20c95a4

def _add_favor_state_argument(*subparsers):
for sub in subparsers:
sub.add_optional_argument_inverse(
"--favor-state",
enable_help="""
If set, defer to the state variable for resolving unselected nodes, even if node exist as a database object in the current environment.
""",
disable_help="""
If defer is set, expect standard defer behaviour.
""",
default=flags.FAVOR_STATE_MODE,
)

Let's just solve for this when we move these flags/etc into the new CLI (#6585). We can always add back-compat for the older env vars + flag names — since, in the meantime, some users might add code to their projects like {{ flags.FAVOR_STATE_MODE }}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli python_api Issues related to dbtRunner Python entry point
Projects
None yet
Development

No branches or pull requests

2 participants