Skip to content

Commit

Permalink
Merge pull request #2627 from kning/ISSUE-2569_bad_target
Browse files Browse the repository at this point in the history
Add more helpful error message for misconfiguration in profiles.yml
  • Loading branch information
beckjake authored Jul 17, 2020
2 parents 3e8414e + d08a2b8 commit 7f0c1f8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
### Features
- Added support for Snowflake query tags at the connection and model level ([#1030](https://github.com/fishtown-analytics/dbt/issues/1030), [#2555](https://github.com/fishtown-analytics/dbt/pull/2555/))
- Added option to specify profile when connecting to Redshift via IAM ([#2437](https://github.com/fishtown-analytics/dbt/issues/2437), [#2581](https://github.com/fishtown-analytics/dbt/pull/2581))

- Add more helpful error message for misconfiguration in profiles.yml ([#2569](https://github.com/fishtown-analytics/dbt/issues/2569), [#2627](https://github.com/fishtown-analytics/dbt/pull/2627))
### Fixes
- Adapter plugins can once again override plugins defined in core ([#2548](https://github.com/fishtown-analytics/dbt/issues/2548), [#2590](https://github.com/fishtown-analytics/dbt/pull/2590))

Contributors:
- [@brunomurino](https://github.com/brunomurino) ([#2437](https://github.com/fishtown-analytics/dbt/pull/2581))
- [@DrMcTaco](https://github.com/DrMcTaco) ([#1030](https://github.com/fishtown-analytics/dbt/issues/1030)),[#2555](https://github.com/fishtown-analytics/dbt/pull/2555/))
- [@kning](https://github.com/kning) ([#2627](https://github.com/fishtown-analytics/dbt/pull/2627))


## dbt 0.18.0b1 (June 08, 2020)
Expand Down
8 changes: 8 additions & 0 deletions core/dbt/config/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,14 @@ def _get_profile_data(
.format(profile_name, target_name, outputs))
raise DbtProfileError(msg, result_type='invalid_target')
profile_data = outputs[target_name]

if not isinstance(profile_data, dict):
msg = (
f"output '{target_name}' of profile '{profile_name}' is "
f"misconfigured in profiles.yml"
)
raise DbtProfileError(msg, result_type='invalid_target')

return profile_data

@classmethod
Expand Down
8 changes: 7 additions & 1 deletion test/integration/049_dbt_debug_test/test_debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def postgres_profile(self):
'pass': 'notmypassword',
'dbname': 'dbt',
'schema': self.unique_schema()
}
},
'none_target': None
})
return profile

Expand Down Expand Up @@ -73,6 +74,11 @@ def test_postgres_wronguser(self):
self.run_dbt(['debug', '--target', 'wronguser'])
self.assertGotValue(re.compile(r'\s+Connection test'), 'ERROR')

@use_profile('postgres')
def test_postgres_empty_target(self):
self.run_dbt(['debug', '--target', 'none_target'])
self.assertGotValue(re.compile(r"\s+output 'none_target'"), 'misconfigured')


class TestDebugProfileVariable(TestDebug):
@property
Expand Down

0 comments on commit 7f0c1f8

Please sign in to comment.