Created
May 23, 2018 18:40
-
-
Save drewbanin/da730cc17bbfd86359b1e425b9be6779 to your computer and use it in GitHub Desktop.
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
{% set n = 100 %} | |
{%- call statement('test_result', fetch_result=True) -%} | |
-- data test | |
select 1 as id, 'Drew' as name | |
union all | |
select 2 as id, 'Connor' as name | |
limit {{ n }} | |
{%- endcall -%} | |
{%- set res = load_result('test_result')['table'] -%} | |
{% if (res | length) > 0 %} | |
{{ log("\nFound " ~ (res | length) ~ " failing records:", info=True) }} | |
{% set _ = res.print_table() %} | |
{{ log("\n", info=True) }} | |
{% for row in res %} | |
select 'fail' as status {% if not loop.last %} union all {% endif %} | |
{% endfor %} | |
{% else %} | |
select 'pass' as status limit 0 | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment