-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added valid authors test + ran pre-commit
- Loading branch information
1 parent
d10a96b
commit e64df8c
Showing
5 changed files
with
42 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{% test only_valid_authors(model, column_name, valid_authors) %} | ||
|
||
with validation as ( | ||
select | ||
distinct lower({{ column_name }}) as author | ||
from {{ model }} | ||
), | ||
|
||
validation_errors as ( | ||
select | ||
author | ||
from validation | ||
where author not in ( | ||
{%- for author in valid_authors -%} | ||
'{{ author | lower }}'{% if not loop.last %},{% endif %} | ||
{%- endfor -%} | ||
) | ||
) | ||
|
||
select * | ||
from validation_errors | ||
|
||
{% endtest %} |