我正在尝试在将一个月添加到我在即将到来的流文件中获得的日期的基础上将流文件拆分为多个流文件。
例如。{"to":"2019-12-31T00:00:00Z","from":"2019-03-19T15:36:48Z"} 是我在 flowfile 中获得的日期。所以我必须将此单个流文件拆分为 11 个流文件,其日期范围为
{"to":"2019-04-19","from":"2019-03-19"}
{"to":"2019-05-19","from":"2019-04-19"}
{"to":"2019-06-19","from":"2019-05-19"}
....... and so till
{"to":"2019-12-31","from":"2019-12-19"} .
我一直在尝试使用示例输入将文件拆分为日常流文件:
`
begin = '2018-02-15'
end = '2018-04-23'
dt_start = datetime.strptime(begin, '%Y-%m-%d')
dt_end = datetime.strptime(end, '%Y-%m-%d')
one_day = timedelta(days = 1)
start_dates = [dt_start]
end_dates = []
today = dt_start
while today <= dt_end:
tomorrow = today + one_day
print(tomorrow)
`
但我的执行脚本处理器出现错误。nifi流截图