The term data transformation refers first of all to the preparation and conversion of data, for example as part of data integration. Data transformation is required, for example, when older IT systems or distributed databases have to be transferred into a new format or consolidated as part of a backup storage solution. For a meaningful presentation and view of data, information from different data sources can also be combined, prepared, and displayed without being stored. Data transformation is a dynamic process that in most cases has to be adapted closely to the source and target structures.
Data Transformation in Detail
To merge data and information from different data sources and structures, the data may have to pass through various processes. Transforming the information also requires a unifying data schema so that the adaptation can be carried out correctly. Data transformation generally uses two approaches, which are briefly described below.
Schema Mapping to the Target Structure
It should be possible to derive the required transformation rules for the data from this mapping. The goal is to achieve the most complete match possible between the source and target schemas. For data sets in SQL databases, a schema transformation is ideally carried out with the database language SQL. Here, the corresponding associations for the mapping can be specified and implemented.
Data Cleansing in the Source Structures
As soon as the mapping of the data sets to the desired target structure is complete, a further important step follows. Taking a legacy data set as an example, numerous errors can occur in the data structures in the form of incorrect, inconsistent, or redundant data. During data transformation, there is an opportunity to correct errors. Often, an old or incorrect date format is converted into a standardized format. The same applies to a large number of other data types.
Options for Data Cleansing
Data cleansing can be divided into two basic process steps. First, corrective steps are applied to the data sets. Second, the content-related aspects of the data are checked and modified where necessary. The two steps can be summarized as follows.
Syntactic Transformation
This process step mainly covers the adaptation and correction of different data types. A classic example among the formal aspects is the correction of the date format. A data schema defines the exact procedure and typing.
Semantic Transformation
A large part of data cleansing consists of checking the content of the data to be transformed. The focus here is on duplicate detection and the alignment of different data values. Examples include recognizing and standardizing gender-specific forms of address (for example Mr. to Herr) or converting values (for example gallons to liters, or inches to meters or centimeters). Supplementing information as part of data enrichment often plays an important role here as well.
Example of a Data Transformation
A transformation process can be carried out in many different ways. A small example illustrates the core process of data transformation. The starting point is a legacy XML database for a book or article archive that is to be adapted to the new business processes of a company and migrated. In the process, the source format XML is to be converted into the JSON format in line with the schema.
<buecher>
<buch>
<titel>Datentransformation</titel>
<isbn>664-3-2530-1102-1</isbn>
<autor>John Doe</autor>
<pubdate>20170125</pubdate>
<seiten>455</seiten>
<verlag>www.dataliquid.de</verlag>
<preis>35,25</preis>
</buch>
<buch>
<titel>Datenintegration</titel>
<isbn>123-3-771-8810-1</isbn>
<autor>Lisa Wend</autor>
<pubdate>20170416</pubdate>
<seiten>385</seiten>
<verlag>www.dataliquid.de</verlag>
<preis>29,35</preis>
</buch>
</buecher>
Because of its high compatibility with XML and YAML, the data is to be consolidated into the JSON format as part of an API definition and the corresponding business types. In the example shown above, differing formats, such as the formats for date and price, also have to be taken into account. A valid JSON declaration of the XML data can look as follows.
{
"buecher": {
"buch": [
{
"titel": "Datentransformation",
"isbn": "664-3-2530-1102-1",
"autor": "John Doe",
"pubdate": "25.01.2017",
"seiten": "455",
"verlag": "www.dataliquid.de",
"preis": "29,95"
},
{
"titel": "Datenintegration",
"isbn": "123-3-771-8810-1",
"autor": "Lisa Wend",
"pubdate": "16.04.2017",
"seiten": "385",
"verlag": "www.dataliquid.de",
"preis": "24,95"
}
]
}
}On the basis of this declaration, a transformation and cleansing was carried out according to the desired data schema, in this example for the currency and date values. If everything works without errors, the data can be imported into the new database or stored in the data warehouse. Often, only a temporary view of consolidated data is required. In this case, the procedure is the same, but the generated views are not stored.
Conclusion
Because of rapid digitalization, data transformation is widely used, particularly in the context of big data applications. In the digital transformation of mass data from old data sets, the ETL pattern is frequently applied.
We create mappings and cleansing rules for SQL databases, XML, and JSON. If you would like to discuss data transformation for your applications, contact us.