How To Combine Multiple Files In Gcs Bucket With Cloud Function Trigger
I have 3 files per date per name in this format: 'nameXX_date', here's an example: 'nameXX_01-01-20' 'nameXY_01-01-20' 'nameXZ_01-01-20' where 'name' can be anything, and the date
Solution 1:
As I understand, the cloud function is triggered by a google.storage.object.finalize
event on an object in the specific GCS bucket.
In that case your cloud function "signature" looks like (taken from the "medium" article you mentioned):
defcompose_shards(data, context):
The data
is a dictionary with plenty of details about the object (file) has been finalized
. See some details here: Google Cloud Storage Triggers
For example, the data["name"]
- is the name of the object under discussion.
If you know the pattern/template/rule according to which those objects/shards are named, you can extract the relevant elements from an object/shard name, and use it to compose the target object/file name.
Post a Comment for "How To Combine Multiple Files In Gcs Bucket With Cloud Function Trigger"