Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
310 views
in Technique[技术] by (71.8m points)

regex - Rename Blob folders with Copy Foreach loops?

I have a hierarchy of parquet files in my blob stored as

yyyy/MM/dd/yyyy_MM_dd_hh_mm_ss_[source].parquet

The dd folders contain multiple files throughout a 24hr period at least one an hour.

examples across folders:

2018/04/01/2018_04_01_06_37_14_ABCXYZ01.Parquet

2019/10/03/2019_10_03_21_52_34_ABCXYZ01.parquet

2020/08/23/2020_08_23_03_00_13_ABCXYZ01.parquet

I would like the folder structure to look like this after the copy.

Year=2019/Month=04/Day=01/2019_04_01_00_00_00_ABCXYZ01.Parquet

I'm probably going to need to copy all 8GB of these files and iterate through but the dynamic content code is what's throwing me off.

Any help on approach would be great. if I do not need to iterate can I use a copy activity and the copy behavior? enter image description here

Thanks

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

you need to dynamically generate your folder path in your sink dataset. Please check below implementation for better Idea.

Step1: GetMetaData activity to get file names from source folder dynamically. enter image description here

Step2: ForEach activity to iterate each file and inside ForEach activity I am dynamically generating destination path format and storing it in to newPath variable. expression used in Set variable: Expression ForEachSetVariable

Step3: Inside ForEach Activity, Copy activity Sink dataset with dynamic parameters to take new Path. ForEachCopy


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...