How can we help you today? How can we help you today?

Databricks SQL Procedure fails via Flyway with "Syntax error at or near end of input" but works in UI

I am trying to deploy a Databricks SQL stored procedure using Flyway, but I am encountering a parsing error during migration execution.

The same procedure runs successfully when executed directly in the Databricks SQL editor, but fails when executed via Flyway.

Error Message:

[PARSE_SYNTAX_ERROR] Syntax error at or near end of input.
SQLSTATE: 42601

The error points to the end of a MERGE statement inside the procedure, suggesting that the statement is not being fully parsed.

What the procedure contains:

  • CREATE OR REPLACE PROCEDURE
  • LANGUAGE SQL
  • A MERGE INTO ... USING (...) statement
  • WHEN MATCHED THEN UPDATE
  • Ends with END;

    Suspected Cause:
    It appears that Flyway may be splitting the SQL script at semicolons (;) before sending it to Databricks, causing the procedure body (especially the MERGE statement) to be incomplete.

    Questions:
  • Does Flyway require a custom delimiter when executing multi-statement Databricks SQL procedures?
  • Is there a recommended way to deploy Databricks SQL procedures via Flyway without encountering statement splitting issues?
  • Are there known limitations when using MERGE inside SQL procedures with Flyway?
Abhinandan
1

Comments

2 comments

  • Christian Perez
    Official comment

    Hi Abhinandan,

     

    Thanks for reaching out to Redgate Support, sorry to hear you are having some trouble with your databricks migration in Flyway. I think that the parsing error that you are describing is potentially a defect, could I trouble you to attach a copy of the creation script for the stored procedure Flyway is erroring on upon migration? I should then be able to reproduce this behavior and get this escalated to development.

     

     

    Christian Perez
  • brian.burge

    I am seeing this same behavior,  my client uses repeatable migrations with wrapping if statements in the current sql server implementation they use, migrating this to data bricks does not work because it seems to be parsing by the ;

    brian.burge
    0

Add comment

Please sign in to leave a comment.