Code Templates
Amorphic Code Templates provide a quick way to create boilerplate code and parameterized scripts that can be attached to resources. They help streamline the code creation process by offering ready-to-use code structures that can be customized as needed.

Creating a Code Template
To create a new code template:
- Navigate to the Templates page and switch to the Code Templates tab
- Click the Create Template button in the top-right corner
- Fill in the Template Details:
| Attribute | Description |
|---|---|
| Template Name | Enter a unique name for the code template |
| Description | Add a description explaining what the code template does |
| Template Arguments | Arguments which will fill up the placeholder values in the user provided code snippets |
- In the next Script Editor panel, upload the required script file to be used as code template. Upon upload, user is free to update it in the same editor panel.
- Click
Saveto create a code template

System Code Templates
The following system code templates are available by default:
| Template Name | Description |
|---|---|
| Amorphic Datasets to Snowflake and Iceberg Data Transfer | Transferring data from Amorphic datasets to Snowflake and Iceberg formats |
| DB2(AS400) to Snowflake Data Transfer | Transferring data from DB2(AS400) database to Snowflake |
| MariaDB to Snowflake Data Transfer | Transferring data from MariaDB database to Snowflake |
| MariaDB to Amorphic Iceberg Dataset Transfer | Transferring data from MariaDB database to Amorphic Iceberg dataset format |
| DB2(AS400) to Amorphic Iceberg Dataset Transfer | Transferring data from DB2(AS400) database to Amorphic Iceberg dataset format |
| Multi-Database Schema Synchronization | Synchronizing schemas across multiple databases |
View Code Template
When viewing a code template, you can see the following sections:
- Template Parameters: This section will have the parameters defined for usage of that template
- Template Code: This section will contain the preview of the template uploaded
It also displays the actions to refresh, edit, share, and delete the code template. These actions are only applicable for user-created templates; users cannot edit or delete system-generated code templates.

Updating a Code Template
User can freely update the template parameters or code for the template. To modify an existing code template:
- Modify the Template Code
- Click Save to update the code template

- System code templates cannot be edited or deleted
- Only user-created templates can be modified or removed
- Be cautious when deleting templates as this action cannot be undone
Using Code Templates
To use a code template:
- Navigate to the appropriate section (ETL Jobs)
- Click Create New and select From Template
- Choose the desired resource template (e.g., Python shell job or Spark job)
- Customize the parameters and placeholders
- In the Script Editor, users have two options: either select the code template or write their own script
- Save and execute as needed

With this job creation process, the job creation is a one-step process and the job will go to the registered status.
Deleting a Code Template
To remove a code template:
- Click the delete icon (trash) in the Actions column
- A confirmation dialog will appear
- Click Delete Code Template to confirm

Best Practices
- Use clear, descriptive names for code templates
- Include comprehensive comments and documentation within the code
- Use meaningful variable names and placeholders
- Test the template by creating code from it after making changes
- Follow coding standards and conventions for the selected language
- Include error handling and logging in your templates
- Make templates reusable and parameterized
- Document any dependencies or requirements