Skip to content

Instantly share code, notes, and snippets.

@dave-connors-3
Last active February 24, 2022 17:19
Show Gist options
  • Save dave-connors-3/e1677b80419d9f4e05fbfb0124a5f578 to your computer and use it in GitHub Desktop.
Save dave-connors-3/e1677b80419d9f4e05fbfb0124a5f578 to your computer and use it in GitHub Desktop.
{% macro check_dupes(model, column_name) %}
with errors as (
{{ test_unique(model, column_name) }}
)
select * from {{ model }}
inner join errors on {{ model.name }}.{{ column_name }} = errors.unique_field
order by {{ column_name }}
{% endmacro %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment