Using fixed values

<< Click to Display Table of Contents >>

ETL > 14.0 u1 > Implementation Guide > Tutorial and implementation guide > Steps > Mapping 

Using fixed values

You can use an automatically generated, non-static value for a column. Currently there are 4 types of auto-columns supported:

Guid
Random UUID (globally unique)

Number
Autoincremented number (locally unique)

DateTime
Date and time (not guaranteed to be unique, neither globally nor locally)

Date
Current date (without time part)

Time
Current time

TableName
The name of the source table (not unique). This type of auto-column makes sense in case when two or more tables are selected by a single map statement, and the information about the source table name is important.

To define auto-column, an object notation in the following format is required:

{

    "columns": {

        "target_column_name": 

        {

            "auto": "<type>"

        },
        [...]            

    }

}

 
Where <type> is one of the supported value: GuidNumberDateTime or TableName. There are no more properties required or defined by auto-columns.

 

Example

Given the following table SourceTable:

Name

Surname

Age

Marcin

Otorowski

34

John

Smith

51

Kate

Binks

25

 
And the following JSON step definition:

    {

      "id": 1,

      "type""map",

      "name""Example of auto-columns",

      "source""SourceTable",

      "columns": {

        "Name""Name",

        "Auto_DateTime": { "auto""datetime" },

        "Auto_Guid": { "auto""guid" },

        "Auto_Number": { "auto""number" },

        "Auto_TableName": { "auto""tableName" }

      },

      "target""TargetTable_AutoColumns"

    }

 

The following result table TargetTable_AutoColumns is expected:

Name

Auto_DateTime

Auto_Guid

Auto_Number

Auto_TableName

Marcin

2021-03-17 11:54:40.000

57992940-6633-4528-9B3A-47563855EE14

1

SourceTable

John

2021-03-17 11:54:40.000

FDE0EA32-E252-408F-8743-52A53BD2F141

2

SourceTable

Kate

2021-03-17 11:54:40.000

0E266619-6689-4A2C-B94F-934E6B095E50

3

SourceTable

 

Arbitrary types, casting and converting

Using the type property lets you define a custom cast or custom type length. This common property is available for all column types, see more information in chapter Arbitrary column types.