Azure Data Factory Copy Data dynamically get last blob - azure

I have an Azure Data Factory Pipeline that runs on a Blob Created Trigger, I want it to grab the last Blob added and copy that to the desired location.
How do I dynamically generate the file path for this outcome?
System Variables
Expressions and Functions

"#triggerBody().folderPath" and "#triggerBody().fileName" captures the last created blob file path in event trigger. You need to map your pipeline parameter to these two trigger properties. Please follow this link to do the parameter passing and reference. Thanks.

Related

When a Particular file is uploaded in blob storage trigger will invoke data pipeline

I want to solve a scenario where when a particular file is uploaded into the blob storage, trigger is invoked and pipeline runs.
I tried event based triggers but I don't know how to tackle this scenario.
I reproduce same in my environment . I got this output.
First create a Blob event trigger .
Note:
Blob path begins with('/Container_Name/') – Receives events form container.
Blob path begins with('/Container_Name/Folder_Name') – Receives events form container_name container and folder_name folder.
Data preview:
Continue and click on OK.
If you created a parameter. For example in my scenario, I created a parameter called file_name directly you can pass the value inside the parameter by using #triggerBody().fileName -> Publish the pipeline.
For more information follow this reference.

Is there any way to know the storage account name when ADF pipeline is triggered using ADF Storage Event Trigger

I am trying to create a ADF Pipeline which gets triggered as soon as a file in uploaded into a storage account. After triggering some operations are performed. I am able to get folder path and file name of the uploaded file. I also wanted to get the storage account name as it is useful in the future processes. Is there any way to extract that.
Currently, there is no option to fetch the storage account name directly from storage event triggers.
As a workaround, you can create a pipeline parameter to store the storage account name and pass the value from the event trigger when creating it.
Creating event trigger:
Here as we are selecting the storage name manually, pass the same
storage name value to the parameter.
Here, in the value option provide the storage account name.
Create a parameter in the pipeline to pull the storage name from the trigger.
Use the Set variable activity to show the parameter value which is passed from the trigger.

Azure Data Factory, BlobEventsTrigger: configure blob path with scheduledTime value which is dynamic content

I have an Azure Data Factory pipeline with two triggers:
schedule trigger
blob event trigger
I would like for blob event trigger to wait for a marker file in storage account under dynamic path e.g.:
landing/some_data_source/some_dataset/#{formatDateTime(#trigger().scheduledTime, 'yyyyMMdd')}/_SUCCESS
Refering to #trigger().scheduledTime doesn't work.
How to pass scheduleTime parameter value from schedule trigger to blob event trigger ?
If I understand correctly, you are trying to edit blob event trigger fields Blob path begins with or Blob path ends with - using the scheduleTime from the scheduleTrigger!
Unfortunately, as we can confirm from the official MS doc Create a trigger that runs a pipeline in response to a storage event
Blob path begins with and ends with are the only pattern matching
allowed in Storage Event Trigger. Other types of wildcard matching
aren't supported for the trigger type.
It takes the literal values.
This does not work:
Only if you have a file names as same ! Unlikely
Also, this dosen't
But, this would
Workaround:
As discussed with #marknorkin earlier, since this is not available out-of-the-box in BlobEventTrigger, we can try use Until activity composed from GetMetadata+Wait activities, where in GetMetadata will check for dynamic path existence.

Is it possible to append only the newly created/arrived blob in Azure blob storage to the Azure SQL DB?

Here is my problem in steps:
Uploading specific csv file via PowerShell with Az module to a specific Azure blob container. [Done, works fine]
There is a trigger against this container which fires when a new file appears. [Done, works fine]
There is a pipeline connected with this trigger, which is appends the fresh csv to the specific SQL table. [Done, but not good]
I have a problem with step 3. I don't want to append all the csv-s within the container(how is's working now), I just want to append the csv which is just arrived - the newest in the container.
Okay, the solution is:
there is a builtin attribute in pipeline called #triggerBody().fileName
Since I have the file which fired the trigger, I can pass it to the Pipeline.
I think you can use event trigger and check Blob created option.
Here is an official documentation about it. You can refer to this.

how to pass a folder from a data lake store as a parameter to a pipeline?

In data factory, I know you can pass a parameter at the beginning of a pipeline, and then access it later using #pipeline(). If I have a folder in a data lake store, how can I pass that as a parameter and have access to it later (let's say I want to loop a for-each over each file inside it.) Do I pass the path to the folder? Am I passing it as an object?
Here are the steps that you can use -
You can use pass folder path as a parameter (string) to the pipeline.
Use the path and "Get Metadata" activity with "Child Items". This will return the list of files in JSON Format
Get Metadata Selection
Loop through using "Foreach" activity and perform any action.
Use output from metadata activity as Items in Foreach activity (example below)
#activity('Get List of Files').output
Hope this helps
First, you need create a data lake store linked service. It will contain the path of azure data lake store. You could use azure data factory UI to create the linked service
Then you need create a data lake store dataset reference that linked service in step 2.
Then you create a getMetaData activity reference dataset in step 2.
Then following steps provided by summit.
All of these can be done in UI.https://learn.microsoft.com/en-us/azure/data-factory/quickstart-create-data-factory-portal#create-a-pipeline

Resources