My Sample code is :
{%- set VARIABLE = ["123","1234"] -%}
{%- set VARIABLE1 = ["abc","def"] -%}
with FINAL as (
{% for (col,col1) in (VARIABLE,VARIABLE1) %}
Select
开发者_Go百科 current_date as date,
{{ col }} as test1,
'{{ col1 }}' as test2
UNION ALL
{% endfor %}
select current_date as date1,
'Temp' as test1,
'Temp' as test2
) select * from FINAL
Output I am getting :
create or replace view Test.CRS_Foundation.test_for
as (
with FINAL as (
Select
current_date as date,
123 as test1,
'1234' as test2
UNION ALL
Select
current_date as date,
abc as test1,
'def' as test2
UNION ALL
select current_date as date1,
'Temp' as test1,
'Temp' as test2
) select * from FINAL
);
Expected Output :
create or replace view Test.CRS_Foundation.test_for
as (
with FINAL as (
Select
current_date as date,
123 as test1,
'abc' as test2
UNION ALL
Select
current_date as date,
1234 as test1,
'def' as test2
UNION ALL
select current_date as date1,
'Temp' as test1,
'Temp' as test2
) select * from FINAL
);
Is there anything i missed in code, code is running fine but output is not as expected Is there anything i missed in code, code is running fine but output is not as expected Is there anything i missed in code, code is running fine but output is not as expected
精彩评论