LiveQuery udf_api support for arrays in data arg (#83)

This commit is contained in:
Julius Remigio 2024-01-23 13:09:56 -08:00 committed by GitHub
parent 3f8b47aa5b
commit a000ce04ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 34 additions and 7 deletions

View File

@ -5,7 +5,7 @@
- [method, STRING]
- [url, STRING]
- [headers, OBJECT]
- [DATA, OBJECT]
- [DATA, VARIANT]
- [user_id, STRING]
- [SECRET, STRING]
return_type: VARIANT

View File

@ -5,7 +5,7 @@
- [method, STRING]
- [url, STRING]
- [headers, OBJECT]
- [data, OBJECT]
- [data, VARIANT]
- [secret_name, STRING]
return_type: VARIANT
options: |
@ -27,7 +27,7 @@
- [method, STRING]
- [url, STRING]
- [headers, OBJECT]
- [data, OBJECT]
- [data, VARIANT]
return_type: VARIANT
options: |
NOT NULL
@ -46,7 +46,7 @@
- name: {{ schema }}.udf_api
signature:
- [url, STRING]
- [data, OBJECT]
- [data, VARIANT]
return_type: VARIANT
options: |
NOT NULL
@ -65,7 +65,7 @@
- name: {{ schema }}.udf_api
signature:
- [url, STRING]
- [data, OBJECT]
- [data, VARIANT]
- [secret_name, STRING]
return_type: VARIANT
options: |

View File

@ -28,7 +28,7 @@ test AS
$${{ context ~ "\n" }}SELECT {{ call ~ "\n" }};$$ AS sql
FROM test
WHERE NOT {{ assertion }}
{%- if not loop.last -%}
{%- if not loop.last %}
UNION ALL
{%- endif -%}
{%- endfor -%}

View File

@ -0,0 +1,27 @@
version: 2
models:
- name: live
columns:
- name: udf_api
tests:
- test_udf:
name: test__live_udf_api_post_data_object
args: |
'https://httpbin.org/post', {'foo': 'bar'}
assertions:
- result:data.json is not null
- result:data.json = OBJECT_CONSTRUCT('foo', 'bar')
- test_udf:
name: test__live_udf_api_post_data_array
args: |
'https://httpbin.org/post', ['foo', 'bar']
assertions:
- result:data.json is not null
- result:data.json = ARRAY_CONSTRUCT('foo', 'bar')
- test_udf:
name: test__live_udf_api_post_data_string
args: |
'https://httpbin.org/post', 'foo'::VARIANT
assertions:
- result:data.json is not null
- result:data.json = 'foo'

View File

@ -1,8 +1,8 @@
-- depends_on: {{ ref('live') }}
{{ config(
materialized = 'view',
grants = {'+select': fromyaml(var('ROLES'))}
) }}
SELECT '*.' || t.value AS allowed_domains
FROM table(flatten(input => {{ this.database }}.live.udf_allow_list())) AS t
ORDER BY