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

[Bug] Fix default dbt target decision policy #926

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions piperider_cli/configuration.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import copy
import json
import os
import shlex
Expand Down Expand Up @@ -558,17 +559,20 @@ def _load(cls, piperider_config_path=None, dbt_profile: str = None, dbt_target:
if profile.get(profile_name):
target_names = list(profile.get(profile_name).get('outputs').keys())
for target in target_names:
dbt_config = copy.deepcopy(dbt)
credential = DbtUtil.load_credential_from_dbt_profile(profile, profile_name, target)
if credential.get('pass') and credential.get('password') is None:
credential['password'] = credential.pop('pass')
datasource_class = DATASOURCE_PROVIDERS[credential.get('type')]
dbt.update(profile=profile_name, target=target)
dbt_config.update(profile=profile_name, target=target)
data_source = datasource_class(
name=target,
dbt=dict(dbt),
dbt=dict(dbt_config),
credential=credential
)
data_sources.append(data_source)

dbt['profile'] = profile_name
# dbt behavior: dbt uses 'default' as target name if no target given in profiles.yml
dbt['target'] = dbt_target if dbt_target else dbt.get('target',
profile.get(profile_name).get('target',
Expand Down
Loading