Skip to content

update_sql_transformation: validate / preserve script field as array (string causes runtime parse error) #245

Description

@beckavac

Context

Hit during a programmatic refactor of 3 production Keboola Snowflake transformations on 2026-05-05. All 3 crashed at runtime after a config update. Bypassed kbagent and went direct to Storage API for the writes (because get_configs returns text — see #244 — so had to use raw JSON anyway).

Problem

parameters.blocks[].codes[].script in a Snowflake transformation is array of statement strings (each element = 1 logical CREATE/INSERT block). Storage API PUT /v2/storage/components/{component}/configs/{config} accepts a string and updates successfully. But on next job run:

Invalid type for path "root.parameters.blocks.0.codes.X.script". Expected "array", but got "string"

If update_sql_transformation (or any wrapper that lets the user provide a full configuration) passes script as string — e.g., user joined for editing and forgot to split back — the same trap applies.

Proposal

Either:

  • (preferred) update_sql_transformation accepts script as either type and always normalizes to array before push (split on statement boundaries, respecting /* */ and -- comments + string literals).
  • Or: validate input and reject string with an explanatory error.

The split logic must respect comment blocks — naive regex split treats commented-out INSERT INTO inside /* */ as a standalone statement, leaving a dangling */ → runtime syntax error.

Related

Repro

Take any Snowflake transformation, fetch raw config, set script of any code to a string, push via Storage API, run job → runtime error above.

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