Skip to content

Commit

Permalink
Add warning for missing constraints. Fixes #592 (#600)
Browse files Browse the repository at this point in the history
* Add warning for missing constraints. Fixes #592

* fix unit tests
  • Loading branch information
drewbanin authored Dec 2, 2017
1 parent 2afc202 commit 1c7f64e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions dbt/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,8 +466,12 @@ def parse_schema_tests(tests, root_project, projects, macros=None):
if test_yml is None:
continue

no_tests_warning = ("* WARNING: No constraints found for model"
" '{}' in file {}\n")
for model_name, test_spec in test_yml.items():
if test_spec is None or test_spec.get('constraints') is None:
test_path = test.get('original_file_path', '<unknown>')
logger.warn(no_tests_warning.format(model_name, test_path))
continue

for test_type, configs in test_spec.get('constraints', {}).items():
Expand Down

0 comments on commit 1c7f64e

Please sign in to comment.