Forum Discussion
Getting modification time in copy activity
Do you want to
a) check the modified time of the files in the source (Azure storage), or
b) check the time when the file was copied by the pipeline?
Do you copy all files from Azure storage into Lakehouse Files folder each time the data pipeline runs?
Or do you want to select only specific files to copy from the Azure storage (based on the file's modified time)?
If you want to check the modified time in the Azure storage, I think you will need to use the Get Metadata activity. (I am hoping that the modified time is available as part of the get metadata ChildItems output. If not, perhaps you could try to connect the Notebook directly to the Azure storage and avoid using Data pipeline copy. Or perhaps we could use Dataflow Gen2 to get the metadata and pass it to the data pipeline via an intermediate table. But I would make some more attempts with Get Metadata first.)
If you want to find the time when the file was processed by the data pipeline, then there are other methods for doing that, let me know if this is what you're looking for.
I need a), the original modification time. The reason is this: Distributed and unreliable systems store the source data on SFTP on Azure. The pipeline works pretty well already, but we have no monitoring for the source systems.
I have come one step close to a solution meanwhile. Like you, I have considered childItems - by itself, it's not useful, because it doesn't contain the modification time. But I can do:
GetMetadata1 -> ForEach(childItems): GetMetadata2: modTime
The outputs of each individual GetMetadata2 contain what I need. Unfortunately, ForEach doesn't gather this output.
A work-around would be to have a notebook activity inside the ForEach to store this information bit by bit in a table, but that's rather ugly.
- frithjof_v1 year agoCommunity Champion
Could you use Append to array variable inside the ForEach?
That way you can store the outputs of each ForEach iteration and use the data stored in the variable in other places in the pipeline.
Do you want to copy only the files where the modified time satisfies some condition? If so, maybe you can use an IF condition in the pipeline, possibly inside the ForEach activity.
Or you want to copy all the files, and just store the modified time also, and then the notebook from Files -> Table will implement logic to use only the files which satisfies some modified time condition?