2023-02-01 15:00:02
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?
The python script below will perform this mapping transformation. A simple breakdown of the script is below:
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