I've created this task in SF using SnowSQL:
CREATE OR REPLACE TASK sv_copy_command_test_task
WAREHOUSE = compute_wh
SCHEDULE = '1 MINUTE'
AS
BEGIN
SET DATE_PATTERN = CONCAT('CALLS/', TO_CHAR(CURRENT_DATE(), 'YYYY/MM/DD'), '/', '.*[.]parquet');
copy into expose_sf_data_trial.decoded.CALLS_COPY_COMMAND
from (select $1:LOAD_ID::varchar::TIMESTAMP_LTZ,
'mainnet' as CHAIN_ID
from @expose_sf_data_trial.decoded.trial_calls_copy_command)
pattern=$DATE_PATTERN;
END;/
!set sql_delimiter=";"
The task has been successfully created but I'm getting the following error in the execution:
SQL compilation error: error line 29 at position 14
Session variable '$DATE_PATTERN' does not exist
I'm creating the DATE_PATTERN variable in the first query, so SF is running the queries in distinct sessions? I don't really know what I'm missing here.
Thanks a lot in advance for your time.