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.
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_configsreturns text — see #244 — so had to use raw JSON anyway).Problem
parameters.blocks[].codes[].scriptin a Snowflake transformation is array of statement strings (each element = 1 logical CREATE/INSERT block). Storage APIPUT /v2/storage/components/{component}/configs/{config}accepts a string and updates successfully. But on next job run: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:
update_sql_transformationaccepts script as either type and always normalizes to array before push (split on statement boundaries, respecting/* */and--comments + string literals).The split logic must respect comment blocks — naive regex split treats commented-out
INSERT INTOinside/* */as a standalone statement, leaving a dangling*/→ runtime syntax error.Related
get_configsreturned structured JSON, users would naturally have array in hand and not need to flatten/reflatten.Repro
Take any Snowflake transformation, fetch raw config, set
scriptof any code to a string, push via Storage API, run job → runtime error above.