mirror of
https://github.com/FlipsideCrypto/livequery-models.git
synced 2026-02-06 10:56:46 +00:00
- Changed thread count from 24 to 5 in GitHub Actions workflows for improved performance. - Added comprehensive README files for various API integrations including Alchemy, NBA All Day, API Layer, Binance, and more. - Introduced new UDFs and UDTFs for Groq and Slack API integrations, enhancing functionality and usability. - Implemented tests for new UDFs and UDTFs to ensure reliability and correctness. - Updated existing UDF definitions and added new tests for enhanced coverage and robustness.
32 lines
657 B
SQL
32 lines
657 B
SQL
{% macro base_test_udtf(model, udf, args, assertions) %}
|
|
{#
|
|
Generates a test for a User-Defined Table Function (UDTF).
|
|
Unlike scalar UDFs, UDTFs return a table of results.
|
|
#}
|
|
{%- set call -%}
|
|
SELECT * FROM TABLE({{ udf }}({{ args }}))
|
|
{%- endset -%}
|
|
|
|
WITH test AS
|
|
(
|
|
SELECT
|
|
'{{ udf }}' AS test_name
|
|
,[{{ args }}] as parameters
|
|
,t.*
|
|
FROM TABLE({{ udf }}({{ args }})) t
|
|
)
|
|
|
|
{% for assertion in assertions %}
|
|
SELECT
|
|
test_name,
|
|
parameters,
|
|
$${{ assertion }}$$ AS assertion,
|
|
$${{ call }}$$ AS sql
|
|
FROM test
|
|
WHERE NOT {{ assertion }}
|
|
{%- if not loop.last %}
|
|
UNION ALL
|
|
{%- endif -%}
|
|
{%- endfor -%}
|
|
{% endmacro %}
|