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-2205] [Feature] Support supply params in dbtRunner.invoke to overwrite flags #7070

Closed
Tracked by #7162 ...
ChenyuLInx opened this issue Feb 27, 2023 · 1 comment · Fixed by #7274
Closed
Tracked by #7162 ...
Assignees
Labels
enhancement New feature or request python_api Issues related to dbtRunner Python entry point

Comments

@ChenyuLInx
Copy link
Contributor

ChenyuLInx commented Feb 27, 2023

Feature description

During dbtRunner.invoke, user should be able to supply a configuration set that used for that invocation with the runner.

# this set of params will overwrite attributes that exists on Flags object during initialization of Flags.
# Anything set here will be visible to the structured logs and exposed in jinja context.
params = {"fail_fast": True, 'version_check': False}

# initialize
from dbt.cli.main import dbtRunner  
dbt = dbtRunner()

# this will fail fast, and not check version
dbt.invoke(['run'], params=params)

Requirement

  • params will overwrite all other formats of configs(env var, cli specified)(during initialization of Flags)
  • Add a structure logging event that include the names of params that got passed in via the params in dbt.invoke
  • Add tests for params that we know dbt-server would want to set/overwrite.
    • log_format
    • log_path
    • version_check
    • project_dir
    • profiles_dir
    • profile_name
    • target_dir
  • Make sure dbt-server is unblocked
@ChenyuLInx ChenyuLInx added enhancement New feature or request python_api Issues related to dbtRunner Python entry point Team:Execution labels Feb 27, 2023
@github-actions github-actions bot changed the title [Feature] Support set programatic_configs in dbtRunner Initialization [CT-2205] [Feature] Support set programatic_configs in dbtRunner Initialization Feb 27, 2023
@ChenyuLInx
Copy link
Contributor Author

ChenyuLInx commented Feb 28, 2023

By doing it this way, anything set by params will still be visible (name + value) to the structured logs (MainReportArgs), exposed in jinja context (docs) and in the args dict of run_results.json.

Let's confirm that this is acceptable for the intended use case. If it isn't acceptable, we should proceed with this work as currently scoped, and open a new issue to address SensitiveFlags (whose values should be excluded/scrubbed from logging, artifacts, Jinja context).

@ChenyuLInx ChenyuLInx changed the title [CT-2205] [Feature] Support set programatic_configs in dbtRunner Initialization [CT-2205] [Feature] Support supply params in dbtRunner.invoke to overwrite flags Feb 28, 2023
aranke added a commit that referenced this issue Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request python_api Issues related to dbtRunner Python entry point
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants