โ12-16-2022 06:21 AM
I am trying to execute a Snowflake query to fetch some columns data in a table using Snowflake Execute snap.
Select โidโ, โuser_nameโ, โuser_locationโ, โuser_emailโ from t_user where โuser_locationโ = โChennaiโ order by โidโ;
Now in the above query I need to parameterize the filter used and so I introduced a pipeline paramter โu_locโ in the pipeline properties and changed the query as below. But it shows query parsing failed error on validation.
โSelect โidโ, โuser_nameโ, โuser_locationโ, โuser_emailโ from t_user where โuser_locationโ = 'โ+_u_loc+โโ order by โidโ;โ
โ12-16-2022 06:50 AM
Hi @azvineth,
Try the following:
"Select 'id', 'user_name', 'user_location', 'user_email' from t_user where 'user_location' = '"+_u_loc+"' order by 'id';"
If you place a mapper in front of the Snowflake Execute snap, youโll be able to validate the query and see how it looks before sending it to Snowflake. Just for debugging purposes.
Regards
Bojan
โ12-16-2022 07:20 AM
@azvineth Can also try the below option -
"Select id, user_name, user_location, user_email from t_user where user_location = โ%sโ order by id ".sprintf(_u_loc)
โ12-16-2022 07:47 AM
@Supratim Nope. Throws the below error.
Failed to execute query: Select id, user_name, user_location, user_email from t_user where user_location = โChennaiโ order by id
Reason:
SQL compilation error: error line 1 at position 7 invalid identifier โIDโ
โ12-16-2022 07:43 AM
@bojanvelevski That did not work. Got the below error.
Failed to execute query: Select โidโ, โuser_nameโ, โuser_locationโ, โuser_emailโ from t_user where โuser_locationโ = โChennaiโ order by โidโ
SQL compilation error:
syntax error line 1 at position 8 unexpected โโidโโ