> For the complete documentation index, see [llms.txt](https://help.daasity.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.daasity.com/technical-docs/transform-code/transform-code/initialization-code.md).

# Initialization Code

This page provides detailed instructions on the Initialization Code transform code block and what should be added to the Script Manifest file in order to execute the code

## Script Manifest File (YML)

### Upstream Transformation Dependencies

{% hint style="info" %}
There are no dependencies on upstream code blocks
{% endhint %}

### Transformation Code Requirements

The following code should be added at the start of the main workflow to ensure that all the required tables that are used in the Daasity data models are generated prior to executing the transformation code

```
  #--------------------------------------------------------------------------------------------------------------------
  # SECTION: 0100_INITIALIZATION
  # DEPENDENCIES: None
  # REQUIRED: Yes
  # PURPOSE: These SQL scripts are required for all merchants to setup the data models and mapping tables that are
  # used in downstream code
  #--------------------------------------------------------------------------------------------------------------------
  initialization:
    scripts:
      - "github://platform-sql-shared/scripts/pro/0000_one_time_initialization/0020_OTI_create_uos_tables.sql"
      - "github://platform-sql-shared/scripts/base/0000_one_time_initialization/0030_OTI_create_uns_tables.sql"
      - "github://platform-sql-shared/scripts/pro/0000_one_time_initialization/0040_OTI_create_ums_tables.sql"
      - "github://platform-sql-shared/scripts/base/0000_one_time_initialization/0050_OTI_create_uts_tables.sql"
      - "github://platform-sql-shared/scripts/base/0000_one_time_initialization/0060_OTI_create_retail_calendar.sql"
      - "github://platform-sql-shared/scripts/base/0100_initialization/0110_INI_BAS_data_validation.sql"
      - "github://platform-sql-shared/scripts/base/0100_initialization/0120_INI_BAS_retail_calendar.sql"
      - "github://platform-sql-shared/scripts/base/0100_initialization/0130_INI_BAS_integration_mapping.sql"
      - "github://platform-sql-shared/scripts/base/0100_initialization/0130_INI_BAS_integration_mapping_amazon.sql"
      - "github://platform-sql-shared/scripts/base/0100_initialization/0140_INI_BAS_currency_exchange_rates.sql"
      - "github://platform-sql-shared/scripts/base/0100_initialization/0160_INI_BAS_amazon_currency_mapping.sql"
```

### One-Time Initialization

{% hint style="success" %}
Add all of these scripts to your initial or main workflow that executes transformation
{% endhint %}

These one-time initialization scripts create the tables for the Unified schemas.  Integration transformation code will fail if these scripts do not first create the tables.

* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/base/0000_one_time_initialization/0020_OTI_create_uos_tables.sql>
* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/base/0000_one_time_initialization/0030_OTI_create_uns_tables.sql>
* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/base/0000_one_time_initialization/0040_OTI_create_ums_tables.sql>
* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/base/0000_one_time_initialization/0050_OTI_create_uts_tables.sql>
* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/base/0000_one_time_initialization/0060_OTI_create_retail_calendar.sql>

### Initialization

{% hint style="success" %}
Add these scripts at the top of your daily workflow to make sure calendars, currency exchange rates and integration mapping are all refreshed
{% endhint %}

Reset the table to help track completion of all your scripts and validate uniqueness across different entities

* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/base/0100_initialization/0110_INI_BAS_data_validation.sql>

Update the daily calendar to easily analyze performance for calendar based dimensions like "Yesterday", "Last Week", "Last Year", etc.

* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/base/0100_initialization/0120_INI_BAS_retail_calendar.sql>

Map your integrations to transform code to ensure that different platforms (GA to Ecommerce) are appropriately linked

* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/base/0100_initialization/0130_INI_BAS_integration_mapping.sql>
* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/base/0100_initialization/0130_INI_BAS_integration_mapping_amazon.sql>

Update the currency exchange rates and Amazon currency exchange rates

* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/base/0100_initialization/0140_INI_BAS_currency_exchange_rates.sql>
* <https://github.com/Daasity/platform-sql-shared/blob/master/scripts/base/0100_initialization/0160_INI_BAS_amazon_currency_mapping.sql>
