The ReMap pipeline in Syncraft is a potent mechanism for reorganizing and transforming data within your pipelines. Unlike other pipelines that can fetch data from external sources, ReMap solely operates on the existing data within the pipeline's input state. This makes it a critical tool for data consolidation and reshaping, which is especially beneficial in pure selection pipelines.
Let's delve into a practical example to better grasp the ReMap pipeline's capabilities:
Below is a JSON representation of a query that incorporates a ReMap Pipeline:
[
{
"query": {
"id": {
"eq": 2
}
},
"selection": {
"id": true,
"name": true
},
"root": "Users"
},
{
"query": {
"Timestamp": {
"gt": "2023-09-10"
},
"UserID": {
"eq": {
"@ref": [
"id"
]
}
}
},
"selection": {
"User": {
"@ref": [
"name"
]
},
"ActionSummary": {
"dataPath": [],
"transformer": ". = join!([\"User\", .User, \"has done action \", .ActionType, \"on\", .Timestamp, \"on a product from category\", .Category, \"and sub category\", .SubCategory], \" \")",
"own": true
},
"ProductID": true,
"Category": true,
"ActionType": true,
"SubCategory": true,
"Timestamp": true
},
"root": "SessionRecord"
},
{
"selection": {
"actions": {
"@ref": [
"ActionSummary"
]
}
}
}
]
The output from the above query will yield the following data:
{
"queryId": "f67bba2c-c7ad-47d7-bccb-65e638bf51c1",
"data": {
"actions": [
"User Bob has done action PURCHASE on 2023-09-10 02:11:31 UTC on a product from category Personal Care and sub category Skin Care",
// ...
]
},
"analysis": null
}
Users
model, filtering for a user with an ID of 2.SessionRecord
model, filtering sessions based on the UserID and Timestamp.ActionSummary
field to be included in the final output under the key actions
.The ReMap pipeline is a key player in your data transformation toolkit within Syncraft. By understanding and utilizing its capabilities, you can efficiently reshape and consolidate your data, ensuring it's structured precisely as needed for your application's requirements.