Skip to main content
Version: v3.4 print this page

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.

Introduction

Creating a Code Template

To create a new code template:

  1. Navigate to the Templates page and switch to the Code Templates tab
  2. Click the Create Template button in the top-right corner
  3. Fill in the Template Details:
AttributeDescription
Template NameEnter a unique name for the code template
DescriptionAdd a description explaining what the code template does
Template ArgumentsArguments which will fill up the placeholder values in the user provided code snippets
  1. 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.
  2. Click Save to create a code template

Create code template

System Code Templates

The following system code templates are available by default. They pair with the corresponding Jobs system resource templates on the Templates page (for example Amorphic-Snowflake/Iceberg, DB2/MariaDB migration, and schema synchronization Spark job templates).

Template NameDescription
Amorphic Datasets to Snowflake and Iceberg Data TransferETL template for transferring data from Amorphic datasets to Snowflake and Iceberg Data Lake. Supports full loads and incremental CDC operations. Features customizable ETL transformations and column sanitization. Useful to migrate data from Bronze Layer datasets into target Snowflake and Iceberg Gold Layer Datasets.
DB2(AS400) to Snowflake Data TransferETL template for transferring data from DB2/AS400 to Snowflake Data Warehouse. Supports full loads and incremental CDC operations via MODE parameter. Features data type mapping, column sanitization, and optimized batch processing.
DB2(AS400) to Amorphic Iceberg Dataset TransferETL template for transferring data from DB2/AS400 to Amorphic Iceberg datasets. Supports full loads and incremental CDC operations via MODE parameter. Features data type mapping, column sanitization, and automatic dataset registration with Amorphic platform.
MariaDB to Snowflake Data TransferETL template for transferring data from MariaDB to Snowflake Data Warehouse. Supports full loads and incremental CDC operations via MODE parameter. Features data type mapping, column sanitization, and optimized batch processing.
MariaDB to Amorphic Iceberg Dataset TransferETL template for transferring data from MariaDB to Amorphic Iceberg datasets. Supports full loads and incremental CDC operations via MODE parameter. Features data type mapping, column sanitization, and automatic dataset registration with Amorphic platform.
Multi-Database Schema SynchronizationComprehensive schema synchronization template for multi-database table creation. Extracts table schemas from heterogeneous source systems (AS/400 DB2, MariaDB) and creates corresponding target tables in both Amorphic (Apache Iceberg) and Snowflake platforms. Features intelligent data type mapping, column sanitization, and dual-target architecture.
info
  • System code templates are not executable out of the box; customize them for your use case.
  • When creating a job, provide all required template parameters for the selected code template.

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.

View code template

Updating a Code Template

User can freely update the template parameters or code for the template. To modify an existing code template:

  1. Modify the Template Code
  2. Click Save to update the code template

Update Template code/parameters

danger
  • 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:

  1. Navigate to the appropriate section (ETL Jobs)
  2. Click Create New and select From Template
  3. Choose the desired resource template (e.g., Python shell job, Spark job, or a migration/schema-sync Spark job template)
  4. Customize the parameters and placeholders
  5. In the Script Editor, users have two options: either select the code template or write their own script
  6. Save and execute as needed

Using Code Template

info

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:

  1. Click the delete icon (trash) in the Actions column
  2. A confirmation dialog will appear
  3. Click Delete Code Template to confirm

Delete code template

Best Practices

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