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

custom schema tests (via macros) #200

Closed
drewbanin opened this issue Nov 1, 2016 · 0 comments
Closed

custom schema tests (via macros) #200

drewbanin opened this issue Nov 1, 2016 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@drewbanin
Copy link
Contributor

create some mechanism to use a macro in a schema.yml file. Eg:

-- macros.sql

-- If a table contains any 👎   `{{expression}}s, then count(*) > 1 and the test fails!
{% macro all_thumbs_up(schema, table, expression) %}

select count(*) from {{schema}}.{{ table }}
where {{ expression }} != 👍 

{% endmacro %}

And in a schema.yml file:

events:
    constraints:
        all_thumbs_up:
            - my_table_name

We need to give this some more thought w/r/t how to handle macros with > 1 argument. Also, should macro-test names be namespaced somehow? Neat, powerful idea though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants