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

Deprecate more env vars #7175

Merged
merged 2 commits into from
Mar 20, 2023
Merged

Deprecate more env vars #7175

merged 2 commits into from
Mar 20, 2023

Conversation

stu-k
Copy link
Contributor

@stu-k stu-k commented Mar 15, 2023

resolves #6903

Description

Deprecate the rest of the environment variables outlined in the issue.

Checklist

@cla-bot cla-bot bot added the cla:yes label Mar 15, 2023
@stu-k stu-k force-pushed the CT-2066/deprecate-old-env-vars branch from 8f51e7e to a57266a Compare March 17, 2023 18:42
@stu-k stu-k marked this pull request as ready for review March 17, 2023 19:04
@stu-k stu-k requested review from a team as code owners March 17, 2023 19:04
@stu-k stu-k requested review from emmyoop, MichelleArk, a team and iknox-fa March 17, 2023 19:04
Comment on lines +47 to +60
def assert_deprecated(self, logs_dir, old_env_var, new_env_var, command="run", old_val="0"):
os.environ[old_env_var] = old_val
run_dbt([command])

# replacing new lines with spaces accounts for text wrapping
log_file = read_file(logs_dir, "dbt.log").replace("\n", " ").replace("\\n", " ")
dep_str = f"The environment variable `{old_env_var}` has been renamed as `{new_env_var}`"

try:
assert dep_str in log_file
except Exception as e:
del os.environ[old_env_var]
raise e
del os.environ[old_env_var]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not so sure about how I handle setting/unsetting env vars here. I am welcome to other suggestions.

Copy link
Contributor

@ChenyuLInx ChenyuLInx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Do we need to do anything for single_threaded? Asking because it was listed in the original issue.

core/dbt/cli/flags.py Outdated Show resolved Hide resolved
core/dbt/cli/requires.py Outdated Show resolved Hide resolved
@stu-k stu-k requested a review from ChenyuLInx March 20, 2023 15:49
Copy link
Contributor

@ChenyuLInx ChenyuLInx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@stu-k stu-k merged commit 137dd9a into main Mar 20, 2023
@stu-k stu-k deleted the CT-2066/deprecate-old-env-vars branch March 20, 2023 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CT-2066] Handle old param/flag names in new CLI
2 participants