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
0

Add comment

Please sign in to leave a comment.