Skip to content

RECURSIVE CTE no longer compiles correctly for INCREMENTAL insert #2083

Description

@bartekelm

Recursive CTE like the example below now compiles to non-working code due to proxy-procedure being used. Worked before on dataform/core=2.4.2.

Code:

EXECUTE IMMEDIATE  """
CREATE OR REPLACE PROCEDURE project.schema.df_09289b69b6be2dab9e8ed4e01adaf8caa53b57ceca86ea247a2494e585e21160() OPTIONS(strict_mode=false)
BEGIN 
    INSERT INTO project.schema.table
    (""" || dataform_columns_list || """)
    SELECT """ || dataform_columns_list || """
    FROM (
     
    WITH RECURSIVE -- materializes output of non-deterministic functions

    cte AS (
        SELECT *
        FROM project.schema.some_table
    )
    ...
)

Error:

Query error: WITH RECURSIVE is only allowed at the top level of the SELECT, CREATE TABLE AS SELECT, CREATE VIEW, INSERT, EXPORT DATA statements.

Issue didn't occur in "non-procedural inserts" of versions 2.x.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions