Code Patterns
Generate transformation code from a form with a Code Pattern: where to find patterns, creating a transformation, mapping, parameters, and generated code.
Code Pattern is a special type of component that
- generates code based on parameters, and
- can be used in the user interface of New Transformations.
Before you start
You need
- A transformation type that a code pattern supports. The public SCD code pattern works with Snowflake SQL and Synapse transformations. A pattern shows up in Use predefined code pattern only for the transformation types it lists.
- A project role that can create configurations. The ReadOnly role cannot. In projects with Governed Change Management, Developers and Reviewers work in a development branch and can’t edit the production branch. See user roles.
What each tab needs
- Prompt tab Kai, the Kai Agent button in the top bar, on supported stacks. A new Free Plan project has it from the start; elsewhere an organization admin turns it on once: Get started with Kai.
- UI tab a browser.
- CLI / API tab kbagent, connected to your project. The checks only read.
List of Code Patterns
Section titled “List of Code Patterns”All components published with Code Pattern can be found in the Keboola Developer Portal (opens in a new tab). To find out which transformation types a component can be used for, read its description.

New Transformation with Code Pattern
Section titled “New Transformation with Code Pattern”This section describes how to create a new transformation with a code pattern.
First, click Transformations on the project menu.
Then click New Transformation to create a new transformation.

In the modal, click the selected type of the transformation.

Fill in the name and, optionally, a description.
Then select a code pattern from the Use predefined code pattern select box.
If a code pattern is missing in the list, please check whether it supports the selected transformation type and it is published.
Click the Create Transformation button.

A new transformation has been created and you can see its configuration.
You can now fill in the Parameters Form and click the Generate Code button.
Follow the instructions at the top of the configuration page.
Configuration
Section titled “Configuration”
The user interface of the configuration consists of the following:
- Instructions on how to set up the code pattern correctly
- Table Input Mapping
- Table Output Mapping
- Parameters Form of the code pattern
- Generate Code button
- Read-only generated code
Input and Output Mapping
Section titled “Input and Output Mapping”Table Input and Output Mapping can be created either
- manually as in ordinary transformations, or
- automatically, generated together with the code if the component supports it.
Follow the instructions at the top of the configuration page.
Below you can see an example mapping. It was generated by the Snapshot - SCD code pattern.

Parameters Form
Section titled “Parameters Form”The parameters determine the content of the generated code. The form is generated dynamically based on the component specification in the Keboola Developer Portal (opens in a new tab). Remember to save your changes.

Generated Code
Section titled “Generated Code”Generated code is read only, it cannot be adjusted manually. It is (re)generated by clicking the Regenerate Code button. This calls the Generate Action (opens in a new tab) on the code pattern component with the actual parameters. The result is then saved and displayed.

After the code has been generated, you can run the job the standard way.
Check:
Does the transformation my-transformation have generated code, and did its latest job succeed?Kai only reads here, so it asks for no approval, and its answer links to what it found in your project.
The generated code shows up read-only in the transformation, next to a Regenerate Code button, and the job detail of the run shows the status Success.
kbagent job list --component-id keboola.snowflake-transformation --config-id 12345 --limit 1Use your transformation’s component and configuration IDs; the job’s Status is success.
Was this page helpful?
Thank you for helping improve Keboola's documentation!