12-28-2021 07:39 AM
Hello,
I have a question about strange behavior of the snap Copy. Part of the my pipeline looks like you can see from the screenshot below:
By logic of the Copy snap, input and output of this should be the same but, in this case “folder” property is change as you can see from the following screenshot.
The snap “Copy (Debug)” has following settings:
Snap “Script Folder List” contain the following Python script:
from com.snaplogic.scripting.language import ScriptHook
#from com.snaplogic.scripting.language.ScriptHook import *
from datetime import datetime
class TransformScript(ScriptHook):
def __init__(self, input, output, error, log):
self.input = input
self.output = output
self.error = error
self.log = log
def execute(self):
self.log.info("Executing Transform script")
while self.input.hasNext():
data = self.input.next()
try:
dt1 = datetime.strptime(data["FileLastUploadDate"], '%Y-%m-%d')
dt2 = datetime.now()
data["CurrentDate"] = datetime.now()
m = dt1.month
p_list = []
for y in range(dt1.year, dt2.year + 1):
while m <= 12:
data["folder"] = str(y) + '_P' + str(m).zfill(2)
m += 1
self.output.write(data)
m = 1
except Exception as e:
data["errorMessage"] = e.message
self.error.write(data)
self.log.info("Finished executing the Transform script")
hook = TransformScript(input, output, error, log)
Please advise what I should do to fix it. Why it’s happened? Actually the same thing happened with mapper (this snap convert the “folder” property in the same way as Copy snap). I can’t understand why this “transformation” is happened.
Thanks