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-1511] A general solution for accessing attributes in the flag object safely #6259

Open
Tracked by #6706
ChenyuLInx opened this issue Nov 16, 2022 · 1 comment
Open
Tracked by #6706
Labels
tech_debt Behind-the-scenes changes, with little direct impact on end-user functionality

Comments

@ChenyuLInx
Copy link
Contributor

ChenyuLInx commented Nov 16, 2022

Issue

Right now in the click cli, we are trying to front load everything in Flags and then trying to use it at the root level CLI function. This makes accessing attributes defined in lower level cli functions possible, but this operation itself is not safe.

For example, right now if we try to run docs command with the click cli(python core/dbt/cli/main.py docs), we will run into error

  File "/Users/chenyuli/git/dbt-core/core/dbt/cli/main.py", line 70, in cli
    initialize_from_flags(flags.ANONYMOUS_USAGE_STATS, flags.PROFILES_DIR)
AttributeError: 'Flags' object has no attribute 'PROFILES_DIR'

since PROFILES_DIR is a parameter that is not defined in any of the command under docs, it never got set in Flags.

potential Exit Criteria:

  1. Rethink about whether construct flags at root level cli and do everything there is the method we want to go next
  2. If answer to 1 is yes, then come up with solutions of making accessing potential non-existence attributes raise warning if there are cases that is not thought through(maybe through auto generated tests?). If the answer to 1 is no, then come up with new way to organize parameters and test that properly.
@ChenyuLInx ChenyuLInx added enhancement New feature or request triage labels Nov 16, 2022
@github-actions github-actions bot changed the title A general solution for accessing attributes in the flag object safely [CT-1511] A general solution for accessing attributes in the flag object safely Nov 16, 2022
@jtcohen6 jtcohen6 added tech_debt Behind-the-scenes changes, with little direct impact on end-user functionality Team:Execution and removed enhancement New feature or request triage labels Nov 16, 2022
@jtcohen6
Copy link
Contributor

Thanks @ChenyuLInx! I added to the list in #5527

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tech_debt Behind-the-scenes changes, with little direct impact on end-user functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants