Questions tagged [snowflake-task]

To be used for posts related to Snowflake tasks: https://docs.snowflake.com/en/user-guide/tasks-intro.html

125 questions
2
votes
2 answers

Is it possible in Snowflake to automate a merge?

Currently I have a script that merges between my source and target table but updating and inserting. Both of these tables update daily through a task created on snowflake. I would like to preform this merge daily too. Is it possible to automate this…
2
votes
2 answers

snowflake copy into table from S3

I am trying to do a simple import of an ASCII file in S3 to a snowflake table. The number of columns in the ASCCI file is the same as the number of columns in the table. I got this to work yesterday using an internal stage in Snowflake, but…
2
votes
1 answer

How to schedule a daily sql script in snowflake db

How to schedule a sql script in the snowflake database to run every day, and set the output file name to include the current date. E.g. if the code ran today then the file name should be 20200906*****.csv.gz, similary for tomorrow…
2
votes
2 answers

How to get maximum value from an array column in Snowflake?

I have a column in snowflake table which is varchar type and contains comma(,) seperated values in it. I used split(mycolumn,',') to change all the comma(,) seperated values into an array. Now, After using split function i have an array of…
2
votes
2 answers

Snowflake Task ran ever minute of the hour

I am currently working on a snowflake "task" to upsert a table every day in the early hours. My current task is created using the below syntax - CREATE OR REPLACE TASK "DB"."SCHEMA"."SAMPLE_TASK" WAREHOUSE = SAMPLE_WAREHOUSE SCHEDULE = 'USING…
Prashanth kumar
  • 949
  • 3
  • 10
  • 32
2
votes
2 answers

Insert into multiple tables using stream & tasks

As per the official documentation, it depicts as though we can insert into multiple tables from a task. Which sounds inaccurate since Once consumed the offsets of the stream are reset It is possible to execute only one SQL statement from a task am…
Somasundaram Sekar
  • 5,244
  • 6
  • 43
  • 85
2
votes
1 answer

Snowflake procedure fail from task execution

The following error message is logged when running the procedure from a task, but works fine when I run it manually: Execution error in store procedure STAGE_SERVICEBUS_ORDER: "Query code" missing from JSON response At Statement.execute, line 4…
2
votes
2 answers

Executing Multiple Lines in a Snowflake Task

I created the task below and am having trouble getting it to execute all lines. It looks like it just does the first delete from productweekly_upload then completes. Anyone have any ideas? This is my first time using tasks CREATE OR REPLACE TASK…
Jeff
  • 427
  • 1
  • 14
  • 31
2
votes
2 answers

get date day full name in snowflake

get date day full name in snowflake I tried to use below query to get day name but giving short name only(3 Chars of day) SELECT upper(trim(DAYNAME(CURRENT_DATE))) O/p: MON Expected output: MONDAY
2
votes
2 answers

Snowflake - Task not running

I have created a simple task with the below script and for some reason it never ran. CREATE OR REPLACE TASK dbo.tab_update WAREHOUSE = COMPUTE_WH SCHEDULE = 'USING CRON * * * * * UTC' AS CALL dbo.my_procedure(); I am using a snowflake trail…
RLT
  • 141
  • 1
  • 2
  • 7
2
votes
1 answer

AGE between 2 dates in snowflake

AGE between 2 dates in snowflake In Netezza we have function called as AGE but snowflake i couldn't find anything similar Netezza: select AGE('2019-12-01', '2018-12-12') - o/p: 11 mons 20 days Is there similar function in snowflake?
Jeyavel
  • 2,974
  • 10
  • 38
  • 48
1
vote
2 answers

Snowflake IF ELSE Stored Procedure logic

I have a tsql code that I'm tryinng to migrate into stored proc on Snowflake. I have a version 1 of the proc built and in production. BUT now have to do a lookup change based on IF-ELSE Logic. I can easily do it as suggested on T-sql but how do I…
1
vote
3 answers

Snowflake How to get Records failed in Copy command

is it possible to get records which failed during Copy command in Snowflake from internal stage to snowflake table? I am trying to load error recrods in a error table during Copy command execution . Copy Command used: Copy into table ( col1,…
1
vote
1 answer

Error while loading csv file to Snowflake Table as "Timestamp '9/15/2020 1:28:00 AM' is not recognized"

csv_file: |column_1 | Column_2 | Column_3 | |===========================================| |abc | xyz | 9/15/2020 1:28:00 AM | I am trying to load a file from s3 to snowflake using following command: COPY INTO table_name FROM…
1
vote
2 answers

Schedule snowflake task to run once a month

I would like to schedule my snowflake task to run once a month. It can be 1st day of the month at 12 AM. I suppose I should use cron statements. I tried to do it like this but I am still getting an error SCHEDULE = ' Using Cron 0 0 1 * *…
1
2
3
8 9