Skip to content

Commit

Permalink
Merge pull request #926 from InfuseAI/bug/sc-32560/bug-fix-piperider-…
Browse files Browse the repository at this point in the history
…default-target-decision

[Bug] Fix default dbt target decision policy
  • Loading branch information
wcchang1115 authored Nov 8, 2023
2 parents 2e487ff + 3b00169 commit b63d01b
Showing 1 changed file with 6 additions and 2 deletions.
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

0 comments on commit b63d01b

Please sign in to comment.