我试图从原始的json数据源创建一个表,并在另一列中引用一个等于current_timestamp的变量。
这是我的代码,我猜测我的任务无法正常运行。也许该变量不是全局变量,并且在任务完成后丢失,或者我设置任务不正确。
-- task 3
create or replace task refresh_timestamp_payrollcompensation
warehouse = task_wh
after copy_pega_sales_payrollcompensation
as set update_timestamp = current_timestamp::timestamp_ntz;
-- task 4
Create or replace task normalize_pega_sales_payrollcompensation
warehouse = task_wh
after refresh_timestamp_payrollcompensation
as create or replace table prod.pega_sales.payrollcompensation
as select
value:Amount::float as Amount,
value:ApprovalDate::timestamp as ApprovalDate,
value:ApprovedBy::varchar as ApprovedBy,
$update_timestamp as update_timestamp
from payrollcompensation_raw_json, lateral flatten (input =>jsontext);
我的下一个想法是,要使update_timestamp变量动态化,我必须以某种方式组合task 3 & task 4
。例)set update_timestamp = current_timestamp::timestamp_ntz
命令和task 4
。
非常感谢任何建议,