To be used for posts related to Snowflake tasks: https://docs.snowflake.com/en/user-guide/tasks-intro.html
Questions tagged [snowflake-task]
125 questions
0
votes
1 answer
Compare variables declared in Snowflake Stored procedure
I got a stored procedure as below
CREATE OR REPLACE PROCEDURE SP12
(argument1 VARCHAR,argument2 VARCHAR
)
if (argument1 <> argument2) { return N1 } else { return N2}
The issue is iam getting error while comparing argument1 <> argument2 (need to…

user1526892
- 61
- 8
0
votes
0 answers
Snowflake Copy Command Result Scan Inconsistency
I am using Copy command to load data from CSV file to a table using internal Stage.
After loading data I am using below code to get number of rows loaded and failed.
Select * from table(Result_Scan('Copy_Query_ID'))
I am also using below query to…

PythonDeveloper
- 289
- 1
- 4
- 24
0
votes
1 answer
How to run pySpark with snowflake JDBC connection driver in AWS glue
I am trying to run the below code in AWS glue:
import sys
from awsglue.transforms import *
from awsglue.utils import getResolvedOptions
from pyspark.context import SparkContext
from awsglue.context import GlueContext
from awsglue.job import Job
from…

Gaurav Gangwar
- 467
- 3
- 11
- 24
0
votes
1 answer
Correlated Sub Queries in Snowflake
Can you please let me know how to convert the below sql server code to Snowflake, since Snowflake doesn't
support correlated sub queries.
SELECT DISTINCT
CURRENT_DATE as creationdate, LastName,
(SELECT Date AS Exp1
FROM PSU AS P
WHERE (HQL =…

Akhira
- 203
- 2
- 5
- 16
0
votes
1 answer
Passing list of tuples as values inside a cte in Snowflake
I am trying to pass a query to Snowflake which has the following format:
query = f"""
insert into target
with incoming (id,name,age) as (
select * from
values ()
), another_cte (
....
)
select * from another cte
"""
For the values, I want to pass a…

vijayjain024
- 43
- 2
- 5
0
votes
2 answers
Snowflake Tasks multiple schedule
I have created a task and scheduled it using cron though I need to run the task at different times during week/weekend. is this possible?
the only option I can think of creating two tasks one for week days run and another for weekend.

vivek_nitd
- 61
- 5
0
votes
1 answer
How to Suspend Child Task
I created two tasks task_1 and task_2 and set dependency. I want to run root task and suspend child task.
But getting below error
alter task task_2 suspend ;
091421 (22000): Unable to update graph with root task TESTDB.PUBLIC.TASK_1 since that root…

PIG
- 599
- 3
- 13
0
votes
3 answers
joining two dataset to get optimal result
Thanks in advance! this is little long question but hopefully it is clear and concise.
I have two different query bringing two data sets.
both datasets are bringing data in same grain for similar area.
first data set has multiple snapshots per month…

Sam
- 7
- 4
0
votes
1 answer
Snowflake Validate Option does not return Failed records When using TO_DATE function in Copy Command
I have used Copy Command as below:
copy into test2 from @%test2 file_format = (format_name = 'CSV') on_error = 'CONTINUE';
My file contains some Character data in Number field ( for all records) so Copy result is LOAD_FAILED and I can get fail…

PythonDeveloper
- 289
- 1
- 4
- 24
0
votes
2 answers
snowflake LISTAGG as `in`
I am trying to use snowflake LISTAGG function in my sub query
This is how I am doing, but I get no results:
SELECT * FROM table WHERE uuid IN (SELECT LISTAGG(''''||uuid||'''', ',') as UUIDS from same_table WHERE condition1 = true AND condition2 =…

Pranav Kotecha
- 85
- 1
- 9
0
votes
1 answer
How to use copy Storage Integration in a Snowflake task statement?
I'm testing SnowFlake. To do this I created an instance of SnowFlake on GCP.
One of the tests is to try the daily load of data from a STORAGE INTEGRATION.
To do that I had generated the STORAGE INTEGRATION and the stage.
I tested the copy
copy into…

Stefano G.
- 143
- 2
- 14
0
votes
2 answers
SNOWFLAKE querying the array of elements
I am using SNOW_FLAKE and trying to query the data stored in the form of array of elements under column name nested_colmn as example:
nested_colmn
[
{
"firstKey": "val1",
"secondKey": 2555,
"thirdKey": false,
"fourthkey":…

hellopa1
- 29
- 4
0
votes
1 answer
Grant monitor on snowflake task
I am trying to grant the monitor privilege on all current and future tasks in a snowflake database to a particular role.
The documentation offers no examples.
I tried GRANT MONITOR ON ALL TASKS ON DATABASE MY_DB TO ROLE ROLE_OVER
Is something like…

vbp13
- 1,040
- 1
- 10
- 20
0
votes
3 answers
Snowflake Task Condition: When Table Has Data
I would like to include a condition in my Snowflake task to run only if a specified table has data in it. This would be similar to task condition:
WHEN SYSTEM$STREAM_HAS_DATA('my_schema.my_table')
Except I do not wish to use a stream. The problem…

Paul M
- 351
- 3
- 14
0
votes
2 answers
Snowflake ifnull and parse_json when combined it is not working as expected
This is my query
select object_construct('id', id, alpha, PARSE_JSON(null)) from tablename
limit 1
the output is { "id" :1, "alpha":null }
but when I combined parse_json with ifnull it returns empty object {} not working as expected
select…

Sundar
- 95
- 1
- 13