Skip to content

Commit 3b00169

Browse files
committed
Fix default dbt target decision policy
Signed-off-by: Wei-Chun, Chang <[email protected]>
1 parent 02b474b commit 3b00169

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

piperider_cli/configuration.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import copy
12
import json
23
import os
34
import shlex
@@ -558,17 +559,20 @@ def _load(cls, piperider_config_path=None, dbt_profile: str = None, dbt_target:
558559
if profile.get(profile_name):
559560
target_names = list(profile.get(profile_name).get('outputs').keys())
560561
for target in target_names:
562+
dbt_config = copy.deepcopy(dbt)
561563
credential = DbtUtil.load_credential_from_dbt_profile(profile, profile_name, target)
562564
if credential.get('pass') and credential.get('password') is None:
563565
credential['password'] = credential.pop('pass')
564566
datasource_class = DATASOURCE_PROVIDERS[credential.get('type')]
565-
dbt.update(profile=profile_name, target=target)
567+
dbt_config.update(profile=profile_name, target=target)
566568
data_source = datasource_class(
567569
name=target,
568-
dbt=dict(dbt),
570+
dbt=dict(dbt_config),
569571
credential=credential
570572
)
571573
data_sources.append(data_source)
574+
575+
dbt['profile'] = profile_name
572576
# dbt behavior: dbt uses 'default' as target name if no target given in profiles.yml
573577
dbt['target'] = dbt_target if dbt_target else dbt.get('target',
574578
profile.get(profile_name).get('target',

0 commit comments

Comments
 (0)