How do I run a Snowflake transformation?
Create, configure, and run a Snowflake SQL transformation in Keboola from start to finish — set input mapping, write the SQL script, set output mapping, run it, and confirm the result table landed in Storage.
You have a table in Keboola Storage and you want to transform it with SQL and write the result back to Storage. This page takes you from nothing to a finished, successful run using a small worked example. For the concepts behind it, see when to use a Snowflake transformation; for exact limits and syntax rules, see the reference.
Time: ~10 minutes · You will need: a Keboola project where you can create configurations, and one table in Storage to read from.
Before you start
Section titled “Before you start”Get a table into Storage to use as the input. If you do not have one handy, upload the sample CSV file as a new table (Storage → your bucket → Create Table) — the example SQL below expects a source table with first and second columns.
Step 1 — Create the transformation
Section titled “Step 1 — Create the transformation”- Open Components → Transformations.
- Click New Transformation.
- Choose Snowflake SQL Transformation as the type.
- Give it a descriptive name (for example,
Double the second column) and confirm.
You now have an empty transformation configuration with sections for input mapping, the script, and output mapping.
Step 2 — Add the input mapping
Section titled “Step 2 — Add the input mapping”The input mapping copies a Storage table into the transformation’s staging area under a name your script will use.
- In Input Mapping, click New Table Input.
- Set Source to your Storage table (the sample table from Before you start).
- Set the Destination (the staging table name) to
source. - Save the mapping.
Step 3 — Write the SQL script
Section titled “Step 3 — Write the SQL script”In the transformation’s code editor, paste:
CREATE OR REPLACE TABLE "result" AS SELECT "first", "second" * 42 AS "larger_second" FROM "source";This reads the staged source table and creates a result table with the first column and second multiplied by 42.
Quote table and column names ("source", "first"). Snowflake folds unquoted names to upper case, which won’t match the identifiers Keboola created — see identifier case sensitivity. You can split longer scripts into blocks to keep them organized.
Step 4 — Add the output mapping
Section titled “Step 4 — Add the output mapping”The output mapping writes a staging table back to permanent Storage. Without it, your result table is discarded when the job ends.
- In Output Mapping, click New Table Output.
- Set Source (the staging table the script created) to
result. - Set Destination to a new Storage table, for example
out.c-main.result. - Save the mapping.
Step 5 — Run it and confirm the result
Section titled “Step 5 — Run it and confirm the result”- Click Run on the transformation.
- Wait for the job to finish with a green/success status.
- Open Storage, find your destination table (
out.c-main.result), and check the data sample: it should containfirstandlarger_second, withlarger_secondequal tosecond × 42.
If the table is there with the expected values, the transformation works.
Make it faster (backend size)
Section titled “Make it faster (backend size)”If the job is slow because of large data or complex queries, raise the backend size in the configuration (XSmall → Small → Medium → Large). A bigger backend allocates more resources; the available sizes and the default are listed in the reference. Dynamic backends are not available on the Free Plan.
Stop a run on a condition
Section titled “Stop a run on a condition”To abort a transformation deliberately (for example, when an integrity check fails) and return a user error, set the ABORT_TRANSFORMATION variable in your script. See aborting execution.
Troubleshooting
Section titled “Troubleshooting”| Symptom | Likely cause | Fix |
|---|---|---|
table source not found (or similar) | Input mapping destination name doesn’t match the script | Make sure the input Destination is exactly source and the script references "source". |
table footable not found despite the table existing | Identifier case mismatch — unquoted names are folded to upper case | Quote identifiers ("source", "first"); see case sensitivity. |
| Run succeeds but nothing appears in Storage | No output mapping, or wrong Source staging name | Add an output mapping whose Source matches the table your script created (result). |
Expression type does not match column data type ... got OBJECT | An ARRAY/OBJECT/VARIANT value wasn’t cast to char | Cast explicitly with TO_CHAR(...); see working with data types. |
| Transformation aborted with a user error | ABORT_TRANSFORMATION was set to a non-empty value | Expected if you use the abort pattern; otherwise check the logic that sets the variable. |
Related
Section titled “Related”- Snowflake transformation reference — limits, data types, timestamps, backend sizes.
- When should I use a Snowflake transformation? — concepts and trade-offs.
- Input and output mapping — how staging works in detail.
- Tutorial: Manipulating data — guided first transformation.