๐บ๏ธ Schema Mapping Asset
Short Description
The Gorgeous Data Schema Mapping Asset is a powerful tool for defining how to migrate data from various source formats (like UObjects, Data Assets, Data Table rows, or Blueprint class defaults) to target assets in Unreal Engine. It allows you to specify field mappings, transformations, and migration settings in a flexible and extensible way.
Long Description
The Gorgeous Data Schema Mapping Asset (UGorgeousDataSchemaMapping_DA) is a data asset that serves as a blueprint for migrating data from a defined source to a target format. It includes properties for specifying the source and target definitions, field mappings with optional transformations, and migration settings that can enable content browser actions for easy execution.
By creating and configuring a schema mapping asset, you can streamline the process of migrating large amounts of data, ensuring consistency and reducing the risk of errors. The asset can be used in conjunction with the FGorgeousDataSchemaMapper class to perform migrations based on the defined schema.
Backup Your Data
When performing data migrations using the schema mapping system, it is highly recommended to backup your project and data before applying any mappings. While the system is designed to be robust and provides detailed error reporting, there is always a risk of unintended consequences when modifying large amounts of data, especially if there are misconfigurations in the schema asset. Always ensure you have a backup to restore from in case anything goes wrong during the migration process.
๐ Features
The Features for Data Schema Mapping comes from the editor toolkit provided. The following documentation outlines Blueprint exposed functions that are part of the UGorgeousDataSchemaMapping_DA class, which can be used to interact with the schema mapping asset in various ways.
IsMigrationActionEnabled
This function checks if the migration action defined in the MigrationDefinition is enabled. It returns a boolean value indicating whether the migration action is active, which can be used to determine if content browser menu actions for migration should be registered.
This function simply returns the value of the bEnableContentBrowserMigrationAction property from the MigrationDefinition struct. If this property is set to true, it indicates that the migration action is enabled and content browser menu actions for migration should be registered. If false, no migration actions will be available in the content browser for this schema mapping asset.
| Type | Description |
|---|---|
| bool | True if the migration action is enabled, false otherwise. |
GetNormalizedTargetContentRootPath
This function retrieves the normalized target content root path based on the current migration definition. It returns a string representing the normalized path where migrated assets will be created.
This function checks the TargetContentRootPath property from the TargetDefinition struct and normalizes it to ensure it is in a valid format for use as a content root path. If the path is valid, it returns the normalized version; if not, it may return an empty string or a default path.
| Type | Description |
|---|---|
| FString | The normalized target content root path, or an empty string if no valid path is defined. |
GetResolvedMigrationActionLabel
This function retrieves the label for the resolved migration action based on the current migration definition. It returns a FText representing the label that should be used for content browser menu actions related to this schema mapping.
This function checks the MenuActionLabel property from the MigrationDefinition struct. If a custom label is defined, it returns that label; otherwise, it may generate a default label based on the schema asset's name or other properties.
| Type | Description |
|---|---|
| FText | The label for the resolved migration action, or an empty text if no action is resolved. |
๐ Properties
SourceDefinition
The SourceDefinition property defines where and how to get the source data for the schema mapping. It includes properties relevant for identifying and validating source items based on the specified SourceKind.
The FGorgeousDataSchemaSourceDefinition_S struct includes properties that specify the kind of source data expected (e.g., UObjects, Data Assets, Data Table rows, or Blueprint class defaults) and additional properties that are relevant for identifying and validating source items based on that kind. For example, if the source kind is set to expect UObjects, the RequiredSourceClass property can be used to specify which class of UObjects should be considered valid sources for this schema mapping.
| Type | Description |
|---|---|
| EGorgeousDataSchemaSourceKind_E | The kind of source data this schema mapping expects. This determines which additional properties are relevant for identifying and validating source items. |
| TSoftClassPtr |
The UObject to draw source mapping properties from for source fields (relevant for certain source kinds). |
| TSoftClassPtr |
The DataAsset to draw from for source fields (relevant for certain source kinds). |
| TSoftObjectPtr |
The DataTable structure to draw from for source fields (relevant for certain source kinds). |
| TSoftObjectPtr |
The DataTable to use for direct schema execution from the schema editor (Bulk Migrate) (relevant for certain source kinds). |
TargetDefinition
The TargetDefinition property defines where and how to apply the data to the target object. It includes properties such as the class of the target assets to be created, the content root path for migrated assets, and an optional source field path used to derive output asset names.
The FGorgeousDataSchemaTargetDefinition_S struct includes properties that specify the class of the target assets to be created by this schema mapping.
| Type | Description |
|---|---|
| TSoftClassPtr |
The class of the target assets to be created by this schema mapping. Must be a subclass of UObject. |
| FString | A Relative content folder path where assets for BulkMigration are should be saved. |
| FString | An optional source field path used to derive the output asset name. If empty, source label is used. |
FieldMappings
The FieldMappings property is an array of field mapping definitions that specify how to map individual fields from the source to the target. Each mapping can include optional transform definitions to modify the data during the mapping process.
Each entry in the FieldMappings array defines a mapping from a source field path to a target field path, along with an optional flag to indicate if the mapping is required and an optional transform definition to apply to the source value before assigning it to the target field.
| Type | Description |
|---|---|
| FString | The source field path to read data from, relative to the source item (e.g., a specific property path on a UObject or a column name in a DataTable). |
| FString | The target field path to write data to, relative to the target asset (e.g., a specific property path on the target UObject). |
| bool | If true, this field mapping is required and the migration will fail if the source field is missing or empty for any source item. |
| FGorgeousDataSchemaTransformDefinition_S | An optional transformation definition to apply to the source field value before assigning it to the target field during migration. |
MigrationDefinition
The MigrationDefinition property defines migration-related settings for the schema mapping, including whether to enable content browser migration actions, the label for those actions, and whether to create folders per source item during migration.
The FGorgeousDataSchemaMigrationDefinition_S struct includes properties that control the behavior of migration actions related to this schema mapping.
| Type | Description |
|---|---|
| bool | If enabled registers a content browser menu action for this schema mapping to migrate source items into target assets based on the defined field mappings and migration settings. |
| FText | The label to use for the content browser menu action when bEnableContentBrowserMigrationAction is true. If empty, a default label based on the schema asset name will be used. |
| bool | If enabled, migrated assets will be organized into subfolders under the specified TargetContentRootPath based on their source item labels or a specified source field value, depending on the TargetAssetNameSourcePath setting. This can help keep migrated assets organized when dealing with a large number of source items or when source items belong to different categories. |