USE CASE:
I want to add only the MMDD to a file. I have a parameter called RunDate to pick up the system date as CCYY-MM-DD. I want to set the file as filename_CMMDD.csv.
SOLUTION:
The best way to do this is to save the file as myFile_TEMP.csv
Then in a subsequent Transform node, use rename(old,new) to rename the file.
The following code should be added to ProcessRecords in the Transform node:
out1 += in1
import os
d=datetime.datetime.strptime('{{^RunDate^}}', '%Y-%m-%d')
old="myFile_TEMP.csv"
new="myFile_"+d.strftime("%m%d")+".csv"
os.rename(old,new)
Comments
0 comments
Please sign in to leave a comment.