Skip to content
Transformations

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.

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.

  1. Open Components → Transformations.
  2. Click New Transformation.
  3. Choose Snowflake SQL Transformation as the type.
  4. 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.

The input mapping copies a Storage table into the transformation’s staging area under a name your script will use.

  1. In Input Mapping, click New Table Input.
  2. Set Source to your Storage table (the sample table from Before you start).
  3. Set the Destination (the staging table name) to source.
  4. Save the mapping.

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.

The output mapping writes a staging table back to permanent Storage. Without it, your result table is discarded when the job ends.

  1. In Output Mapping, click New Table Output.
  2. Set Source (the staging table the script created) to result.
  3. Set Destination to a new Storage table, for example out.c-main.result.
  4. Save the mapping.
  1. Click Run on the transformation.
  2. Wait for the job to finish with a green/success status.
  3. Open Storage, find your destination table (out.c-main.result), and check the data sample: it should contain first and larger_second, with larger_second equal to second × 42.

If the table is there with the expected values, the transformation works.

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.

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.

SymptomLikely causeFix
table source not found (or similar)Input mapping destination name doesn’t match the scriptMake sure the input Destination is exactly source and the script references "source".
table footable not found despite the table existingIdentifier case mismatch — unquoted names are folded to upper caseQuote identifiers ("source", "first"); see case sensitivity.
Run succeeds but nothing appears in StorageNo output mapping, or wrong Source staging nameAdd an output mapping whose Source matches the table your script created (result).
Expression type does not match column data type ... got OBJECTAn ARRAY/OBJECT/VARIANT value wasn’t cast to charCast explicitly with TO_CHAR(...); see working with data types.
Transformation aborted with a user errorABORT_TRANSFORMATION was set to a non-empty valueExpected if you use the abort pattern; otherwise check the logic that sets the variable.
Ask Kai

Ask anything about Keboola — I'll search the docs and cite the pages I use.