Back to Glossary Index

Schema Mapping

Translate data from one schema or structure to another to facilitate data integration.

Schema mapping definition:

Schema mapping is the process of mapping the schema of one dataset to the schema of another dataset in order to integrate or merge them. It involves mapping the fields or attributes of one dataset to the fields or attributes of another dataset, ensuring that the data types, formats, and other properties match between the two datasets. Schema mapping is a crucial step in data integration, as it enables datasets with different schemas to be combined and analyzed together.

Schema mapping example using Python:

Please note that you need to have the necessary Python libraries installed in your Python environment to run this code.

In Python, one way to perform schema mapping is by using the PySpark library. Here's an example:

# Importing the required libraries
from pyspark.sql import SparkSession
from pyspark.sql.functions import col

# Creating a SparkSession
spark = SparkSession.builder.appName("Schema Mapping Example").getOrCreate()

# Creating a sample dataframe with multiple columns
data = [("John", 25, "25000.50"), ("Smith", 30, "35000.75"), ("Jane", 28, 32000.25)]
df = spark.createDataFrame(data, ["name", "age", "salary"])

# Defining the mapping schema
mapping_schema = {
    "name": "string",
    "age": "integer",
    "salary": "double"
}

# Creating a new dataframe with the mapped schema
mapped_df = df.select([col(c).cast(mapping_schema[c]).alias(c) for c in mapping_schema.keys()])

# Displaying the original and mapped dataframes
print(f"Original dataframe: {df}")
print(f"Mapped dataframe: {mapped_df}")

# Applying some transformations on the mapped dataframe
filtered_df = mapped_df.filter(mapped_df.age > 25)
grouped_df = filtered_df.groupBy("name").agg({"salary": "sum"})

# Stopping the SparkSession
spark.stop()

This will print out the schema of each dataframe showing the new mapping:

Original dataframe: DataFrame[name: string, age: bigint, salary: string]
Mapped dataframe: DataFrame[name: string, age: int, salary: double]

Other data engineering terms related to
Data Management:

Archive

Move rarely accessed data to a low-cost, long-term storage solution to reduce costs. store data for long-term retention and compliance.

Augment

Add new data or information to an existing dataset to enhance its value. Enhance data with additional information or attributes to enrich analysis and reporting.

Backup

Create a copy of data to protect against loss or corruption.

Curation

Select, organize and annotate data to make it more useful for analysis and modeling.

Deduplicate

Identify and remove duplicate records or entries to improve data quality.

Dimensionality

Analyzing the number of features or attributes in the data to improve performance.

Enrich

Enhance data with additional information from external sources.

Export

Extract data from a system for use in another system or application.

Index

Create an optimized data structure for fast search and retrieval.

Integrate

combine data from different sources to create a unified view for analysis or reporting.

Memoize

Store the results of expensive function calls and reusing them when the same inputs occur again.

Merge

Combine data from multiple datasets into a single dataset.

Mine

Extract useful information, patterns or insights from large volumes of data using statistics and machine learning.

Model

Create a conceptual representation of data objects.

Monitor

Track data processing metrics and system health to ensure high availability and performance.

Named Entity Recognition

Locate and classify named entities in text into pre-defined categories.

Parse

Interpret and convert data from one format to another.

Partition

Divide data into smaller subsets for improved performance.

Prep

Transform your data so it is fit-for-purpose.

Preprocess

Transform raw data before data analysis or machine learning modeling.

Replicate

Create a copy of data for redundancy or distributed processing.

Scaling

Increasing the capacity or performance of a system to handle more data or traffic.

Synchronize

Ensure that data in different systems or databases are in sync and up-to-date.

Validate

Check data for completeness, accuracy, and consistency.

Version

Maintain a history of changes to data for auditing and tracking purposes.