Denormalize Transformation
You can create many-to-one mappings with the help of a Denormalize transformation object in Astera. Denormalizing, also known as pivoting, allows you to combine a number of records into a single record (in short, it brings data from rows to columns).
It is useful for reducing the number of tables in the schema, which simplifies querying and improves reading performance.
Sample Use Case
The TaxInfo source data contains information about TaxType (City Tax, County Tax, State Tax, and Federal Tax), Tax Amount, and SSN (Social Security Number) of taxpayers.
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F750977703-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FqHxyVNGb7tSdIWecl6Ru%252Fuploads%252Fi18kjNeKJ4YbRD9BQZGM%252F0.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=106fb590&sv=1)
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F750977703-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FqHxyVNGb7tSdIWecl6Ru%252Fuploads%252F98ko7naJM2moSU7SfvxE%252F1.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=82d7f67c&sv=1)
We want to reduce the number of rows and create separate fields for City tax, County tax, State tax, and Federal tax.
Let’s see how can we use the Denormalize transformation object to achieve this.
Using the Denormalize Transformation
First, we will use the Sort object to sort our source data based on the key field, SSN in our case.
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F750977703-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FqHxyVNGb7tSdIWecl6Ru%252Fuploads%252FhhT8VdnarJtZGSm49bIp%252F2.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=7834f9de&sv=1)
Drag-and-drop the Denormalize transformation object from the Transformations section in the Toolbox.
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F750977703-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FqHxyVNGb7tSdIWecl6Ru%252Fuploads%252FMj8EZinWTWhyTobqhFw9%252F3.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=33f29815&sv=1)
Right-click on the Denormalize transformation object and select Properties from the context menu.
Following are the properties available for the Denormalize transformation object:
Layout Builder Window: The Layout Builder window is used to add and/or remove fields, as well as to select their data type. The fields added in the Layout Builder will show in the Output node inside the object, as well as in all Input nodes corresponding to the number of mapping groups created (see below), with the exception of the key field(s).
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F750977703-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FqHxyVNGb7tSdIWecl6Ru%252Fuploads%252FZuTsUwHD4fXVESYV6cHg%252F4.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=2cb660ef&sv=1)
Denormalize (Many-to-One) Transformation Properties Window:
Select Keys: Using the Select Keys dropdown, select the field or fields that uniquely identify the record. These keys will be used to match records between the normalized source and the denormalized destination.
Sort Input: Check this option only if values in the matching field (or fields) are not already sorted.
Driver Field Value: Enter the pivot values for your Denormalize transformation object. Using the example below, the pivot values would be City, State, Federal, and Country.
Note: Entering Driver Key Values is required prior to mapping the Denormalize object. For each entry in the Driver Field Value grid, a new input mapping group is created in the object box.
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F750977703-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FqHxyVNGb7tSdIWecl6Ru%252Fuploads%252FBNXJaU5ALtUGC7wVB1h6%252F5.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=fffb3b07&sv=1)
General Options Window: This window shares options common to most objects in the dataflow.
Clear Incoming Record Messages: When this option is checked, any messages coming in from objects preceding the current object will be cleared. This is useful when you need to capture record messages in the log generated by the current object and filter out any record messages generated earlier in the dataflow.
Do Not Process Records with Errors: When this option is checked, records with errors will not be output by the object. When this option is off, records with errors will be output by the object, and a record message will be attached to the record. This record message can then be fed into downstream objects in the dataflow, for example, a destination file that will capture record messages or a log that will capture messages and collect statistics as well.
The Comments input allows you to enter comments associated with this object.
After you have configured the properties, click OK.
An Input mapping node will be created for each value previously specified in the Driver Field Value grid.
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F750977703-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FqHxyVNGb7tSdIWecl6Ru%252Fuploads%252FvdUj3z2tIOkQzhjK6qdw%252F6.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=f8185daf&sv=1)
Map the fields and preview the output to view the denormalized data.
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F750977703-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FqHxyVNGb7tSdIWecl6Ru%252Fuploads%252FkEEcyl3XvAVeNZfZW3LV%252F7.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=6855b491&sv=1)
![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2F750977703-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FqHxyVNGb7tSdIWecl6Ru%252Fuploads%252FeBTGsr7BOC6F1vSkYtBF%252F8.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=4bd1c10&sv=1)
Last updated