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

Decouple project creation logic from tasks CT-299 #4981

Merged
merged 5 commits into from
Apr 8, 2022

Conversation

iknox-fa
Copy link
Contributor

@iknox-fa iknox-fa commented Mar 30, 2022

Resolves #4804

Description

Adds a utility to dbt.config to allow for ad-hoc project object generation

Additional context

This isn't a great solution-- A much better pattern would be to untangle the way we current launch tasks and incorporate a built-the-project-first approach as a first class citizen instead of a random config util. I started work down that path but issues with our various context managers and time limitations have foiled that plan. The work done in that direction can be seen on this WIP branch and will be useful in future cli-related work.

Checklist

  • I have signed the CLA
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • I have added information about my change to be included in the CHANGELOG.

@iknox-fa iknox-fa requested review from a team as code owners March 30, 2022 15:13
@cla-bot cla-bot bot added the cla:yes label Mar 30, 2022
@github-actions
Copy link
Contributor

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.

user_config = read_user_config(flags.PROFILES_DIR)
# Update flags
flags.set_from_args(args, user_config)
profile = Profile.render_from_args(args, ProfileRenderer(cli_vars), profile_name)
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like cli_vars is only used when a profile is not provided, is it safe to assume that the provided profile will always have cli_vars set?

Copy link
Contributor Author

@iknox-fa iknox-fa Apr 8, 2022

Choose a reason for hiding this comment

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

is it safe to assume that the provided profile will always have cli_vars set

Nope, but the profile is valid wether or not it has cli_vars so we don't need to do anything special here.

return "models"

@property
def project_config(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the test be a unit test that only test get_project_config's function? This would work but I feel like it is harder to know exactly what is being tested if just reading the code.

@iknox-fa iknox-fa merged commit 5f2a438 into main Apr 8, 2022
@iknox-fa iknox-fa deleted the iknox-decouple-proj-config-CT-299 branch April 8, 2022 19:28
agoblet pushed a commit to BigDataRepublic/dbt-core that referenced this pull request May 20, 2022
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-299] Decouple project configs from Task logic
3 participants