Not able to execute Snowflake stored procedure from ADF via Script or Lookup activity

Satish Burnwal 0 Reputation points
2024-08-30T14:01:27.6066667+00:00

I am not able execute Snowflake Stored Procedure which accepts parameters from ADF via Script or Lookup activity. Though I know Script parameters are not supported in Script activity currently after update but also as suggestion, I have tried to use a concat function to call the stored proc as below :

@concat('CALL EMPLOYEE_DB.DEV.GetEmpDetails(','''A''',')')

But it gives weird error as :
Failed to execute script. Exception: ''Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Failed to execute the query command during read operation.,Source=Microsoft.DataTransfer.Execution.ScriptActivityExecutor,''Type=Apache.Arrow.Adbc.AdbcException,Message=[Snowflake] parsing time "18284" as "2006-01-02": cannot parse "4" as "-",Source=Apache.Arrow.Adbc,''

This is really frustrating that after the updates, parameters are not supported. Please help with a solution

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
10,697 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Satish Burnwal 0 Reputation points
    2024-09-10T06:28:31.83+00:00

    Finally was able to figure it out with the updated/new connector.

    Snowflake Stored Proc : [DB NAME : Emp_DB | Schema Name : Emp_Schema]

    CREATE OR REPLACE PROCEDURE Emp_DB.Emp_Schema.UPDATEEMPDETAILS("ID" NUMBER(38,0), "EMAIL_ID" VARCHAR(16777216))

    RETURNS VARCHAR(16777216)

    LANGUAGE SQL

    EXECUTE AS OWNER

    AS 'BEGIN

    UPDATE Emp_DB.Emp_Schema.Employee SET Email_ID= :Email_ID WHERE ID = :ID;

    END';

    Below code snippet can be used to run a stored proc from ADF via script activity :

    declare  
    query text := '';
    begin
    EXECUTE IMMEDIATE 'USE SCHEMA METADATA';
     
    query := (Call UpdateEmpDetails(@{pipeline().parameters.ParamValue3_ID},'@{pipeline().parameters.ParamValue4_EmailID}'));
    end;
    

  2. Bhargava-MSFT 31,021 Reputation points Microsoft Employee
    2024-09-10T16:52:44.2933333+00:00

    Hello,

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer.

    Issue: Unable to execute Snowflake stored procedure from ADF via Script or Lookup activity

    Unable to execute Snowflake Stored Procedure which accepts parameters from ADF via Script or Lookup activity. Though I know Script parameters are not supported in Script activity currently after update but also as suggestion, I have tried to use a concat function to call the stored proc as below :

    @concat('CALL EMPLOYEE_DB.DEV.GetEmpDetails(','''A''',')')

    Error:

    Failed to execute script. Exception: ''Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Failed to execute the query command during read operation.,Source=Microsoft.DataTransfer.Execution.ScriptActivityExecutor,''Type=Apache.Arrow.Adbc.AdbcException,Message=[Snowflake] parsing time "18284" as "2006-01-02": cannot parse "4" as "-",Source=Apache.Arrow.Adbc,''

    Solution:

    Here is the solution with the updated/new connector.

    Snowflake Stored Proc : [DB NAME : Emp_DB | Schema Name : Emp_Schema]

    CREATE OR REPLACE PROCEDURE Emp_DB.Emp_Schema.UPDATEEMPDETAILS("ID" NUMBER(38,0), "EMAIL_ID" VARCHAR(16777216))

    RETURNS VARCHAR(16777216)

    LANGUAGE SQL

    EXECUTE AS OWNER

    AS 'BEGIN

    UPDATE Emp_DB.Emp_Schema.Employee SET Email_ID= :Email_ID WHERE ID = :ID;

    END';

    Below code snippet can be used to run a stored proc from ADF via script activity :

    declare  
    query text := '';
    begin
    EXECUTE IMMEDIATE 'USE SCHEMA METADATA';
     
    query := (Call UpdateEmpDetails(@{pipeline().parameters.ParamValue3_ID},'@{pipeline().parameters.ParamValue4_EmailID}'));
    end;
    
    
    

    Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.

    0 comments No comments

  3. T1 - Jonathan Armstrong 0 Reputation points
    2024-10-10T04:07:49.2466667+00:00

    It does appear that Microsoft has deprecated (unintentionally?) the ability to use script parameters in the new Snowflake connector. I had to do a triple take to ensure I wasn't missing anything but upon upgrading all of our connectors in the last couple of days it does appear that previous parameterized Script component calls are no longer working. This would strike me as an oversight and a high profile "bug" versus a new "enhancement" if so. Is there a priority on getting this fixed?

    Cheers & Regards,

    Jonathan Armstrong

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.