Notifications
Clear all

[Solved] How can I use NEO Plasma to map my source file schema to by output file schema?

1 Posts
1 Users
1 Likes
5,984 Views
0
Topic starter

I have a Stream of Record as my input, which adheres to my source files schema. I want to map my source file values to my output Schema, how would I accomplish this?

1 Answer
1
Topic starter

The python script below will perform this mapping transformation. A simple breakdown of the script is below:

  • Stream of Record is sent as input
  • iterable_inputs is created for "Input 1"
  • iterate over all records within iterable_inputs["Input 1"]
  • Within yield, map values from the source schema to match output schema
    • ItemName = record["productName"]
    • Description = record["description"]
    • etc.
  • "Output 1" will yield Stream of Records for all records with your mapping applied

 

def executeNode(inputs):
  iterable_inputs = {}
  outputs = {}
   
  # Input ports
   
  iterable_inputs["Input 1"] = inputs["Input 1"]
  # Type = stream.record
  # cost, msrp, description, upc, weight, currency, weightUom, productName
   
  # Add node logic here
  for record in iterable_inputs["Input 1"]:
    yield {
      "Output 1": {
        "ItemName": record["productName"],
        "Description": record["description"],
        "ManagingEntName": record["entName"],
        "ManufacturerPrice": record["msrp"],
        "Price": record["msrp"],
        "Currency": record["currency"],
        "CaseUPC": record["upc"],
        "PackageUPC": record["upc"],
        "Weight": record["weight"],
        "WeightUOM": record["weightUom"],
        "Active": True
      }
    }
   
  # Activate and set outputs (omit a port to prevent execution of nodes that depend on that port)
   
  # Type = stream.record
   
  return outputs