Script Activity not supporting multi-instruction with new Snowflake connector

DavidR 40 Reputation points
2024-03-21T08:23:45.0033333+00:00

I have a pipeline, in Azure Data Factory that has an "Activity Script" that executes 3 instructions against Snowflake. The script was working fine until I have updated the Snowflake connection in order to remove the legacy Snowflake connection as you recommended. But now, my script does not work. I have seen in the Snowflake logs that the new connection executes this instruction in Snowflake: "alter session set multi_statement_count = 1;"; this means that the Activity Script only supports one instruction. How can I set the multi_statement_count parameter in order to be 0? (with the legacy Snowflake connection I have seen in Snowflake logs that an instruction "alter session set multi_statement_count = 0;" is executed).

Thanks in advance

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

5 answers

Sort by: Most helpful
  1. Laan, Niels 10 Reputation points
    2024-05-31T08:44:24.4333333+00:00

    As a workaround, you can wrap your SQL code in between BEGIN ... END statements.

    BEGIN

    UPDATE TABLE SET A = B;

    UPDATE TABLE SET A= B;

    END;

    2 people found this answer helpful.

  2. LeelaRajeshSayana-MSFT 17,766 Reputation points Moderator
    2024-04-02T16:13:53.0333333+00:00

    Hi @DavidR Apologies for the delayed feedback on this. For a deeper investigation and immediate assistance on this issue, please file a support request @ https://aka.ms/azsupt? If you do not have access to a support plan, could you please send an email to azcommunity@microsoft.com with the below details, so that we can work closely on this matter.

    Thread URL: Link to this thread.

    Azure Subscription ID:

    Email Subject : Attn Leela

    0 comments No comments

  3. Ian Johnson 0 Reputation points
    2024-04-09T23:09:38.75+00:00

    A workaround. In Snowflake, wrap all your SQL statements with a stored procedure. Then in ADF Script Activity call only your Stored Procedure.

    0 comments No comments

  4. Amit Pandit 0 Reputation points
    2024-05-30T04:15:10.67+00:00

    ADF snowflake:

    I have same issue with the error message 'Actual statement count 2 did not match the desired statement count 1'

    The workaround to stored procs doesnt seem feasible since that will I have some dynamic strings to be executed, and that will be too much extra effort.


  5. Marco Flores 0 Reputation points
    2024-07-26T01:37:28.9666667+00:00

    Late in the conversation, but You can use the Script: "non query" option instead "Query" , and you can run multiples statements with out problem.

    I hope this helps.


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.