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

Add more helpful error message for misconfiguration in profiles.yml #2627

Merged
merged 4 commits into from
Jul 17, 2020
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
### 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 ([#2627](https://github.com/fishtown-analytics/dbt/issues/2569))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Add more helpful error message for misconfiguration in profiles.yml ([#2627](https://github.com/fishtown-analytics/dbt/issues/2569))
- 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/issues/2569))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- [@kning](https://github.com/kning) ([#2627](https://github.com/fishtown-analytics/dbt/issues/2569))
- [@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 @@ -197,6 +197,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