Azure Data Factory SQL trigger events - azure

I wanted to comment on this post: I want to trigger Azure datafactory pipeline whenever there is a change in Azure SQL database
but I don't have enough reputation...
The solution that Skin comes up with (SQL DB trigger events) looks exactly like what I'm after but I can't find any further documentation on it - in fact the only references I've found say that this functionality doesn't exist?
Can anyone point me to anything online - or a book - that could help?
Cheers

AFAIK, In ADF there are no such triggers for SQL changes. ADF supports only Schedule,Tumbling window and Storage event and custom event triggers.
But You can use the logic app triggers (item created and item modified) to triggers ADF pipeline.
For this we the SQL table should have an auto increment column.
Here is a demo I have built for item created trigger:
First search for SQL in logic app and click on item created trigger. Then create a connection with your details.
After that give your table details.
After trigger create Action for ADF pipeline run.
Make sure you publish your ADF pipeline to reflect its name in the above drop down. You can assign SQL columns to ADF pipeline parameter like above.
You can set the trigger for one every one minute or one hour as per your requirement. If any new item inserted into SQL table in that period of time it will trigger ADF pipeline.
I have inserted a new record like this insert into practice values('Six');
Flow Suceeded:
My ADF pipeline:
Pipeline Triggered:
Pipeline successful and you can see variable value:
You can use another flow for item modified trigger as same above and trigger ADF pipeline from that as well.

with the new latest feature A new feature that allows invocation of any REST endpoints is now in public preview in Azure SQL databases
, I guess it is possible :
https://devblogs.microsoft.com/azure-sql/azure-sql-database-external-rest-endpoints-integration-public-preview/
Blog:
https://datasharkx.wordpress.com/2022/12/02/event-trigger-azure-data-factory-synapse-pipeline-via-azure-sql-database/

Related

azure data factory pipeline and activities Monitor

I have about 120 pipeline with almost 400 activities all together and I would like to log them in our datalake storage system so we can report on the performance using powerBI. I came across How to get output parameter from Executed Pipeline in ADF? but it seems to me to work with a single pipeline, but I am wondering if I could get the whole pipeline in my ADF in one single call and the activities also.
Thnaks
Assuming the source in these pipelines varies which makes it difficult to apply the logic for monitoring.
One way is to store the logs individually for each pipeline by running some queries with pipeline parameters. Refer Option 2 in this tutorial.
Although, the best feasible and appropriate way to monitor ADF pipelines and activities is to use the Azure Data Factory Analytics.
This solution provides you a summary of overall health of your Data Factory, with options to drill into details and to troubleshoot unexpected behavior patterns. With rich, out of the box views you can get insights into key processing including:
At a glance summary of data factory pipeline, activity and trigger
runs
Ability to drill into data factory activity runs by type
Summary of data factory top pipeline, activity errors
Go to Azure Marketplace, choose Analytics filter, and search for Azure Data Factory Analytics (Preview)
Select Create and then create or select the Log Analytics Workspace.
Installing this solution creates a default set of views inside the workbooks section of the chosen Log Analytics workspace. As a result, the following metrics become enabled:
ADF Runs - 1) Pipeline Runs by Data Factory
ADF Runs - 2) Activity Runs by Data Factory
ADF Runs - 3) Trigger Runs by Data Factory
ADF Errors - 1) Top 10 Pipeline Errors by Data Factory
ADF Errors - 2) Top 10 Activity Runs by Data Factory
ADF Errors - 3) Top 10 Trigger Errors by Data Factory
ADF Statistics - 1) Activity Runs by Type
ADF Statistics - 2) Trigger Runs by Type
ADF Statistics - 3) Max Pipeline Runs Duration
You can visualize the preceding metrics, look at the queries behind these metrics, edit the queries, create alerts, and take other actions.

Alternative to trigger Azure Functions or AppService based on a table row insert into Azure SQL MI

Is it possible to trigger Azure Functions or AppService webapp whenever an insert operation is performed against a table on Azure SQL MI?
if not, is there a way to trigger applications outside Azure SQL rather than using LogicApp? I want to avoid LogicApp because it requries using one more application, and it is still using polling.
Link below said it is not for Azure functions
https://feedback.azure.com/forums/355860-azure-functions/suggestions/16711846-sql-azure-trigger-support
Link below suggests using LogicApp.
Trigger Azure Function by inserting (adding) new row into table, SQL Server Database
Today, in Azure SQL, there is no such possibility. The closest option is to create a Timer Trigger Azure Function that checks if there has been any changes in the table you want to monitor (using Change Tracking, for example).
If you are using Azure SQL MI instead, you could create a SQLCLR procedure that calls an Azure Function via an HTTP request or, another option, via Azure Event Hubs or Azure Event Grid
There have been several feature requests for triggering Azure functions based on changes to at Azure SQL database. For example:
https://github.com/Azure/azure-functions-python-worker/issues/365
It seems that they are not prioritizing it, since it is possible to implement this functionality using logic apps.

Edit pipeline query in azure data factory V1 manually

How to edit pipeline and data sets query in azure data factory v1 manually
With the recent changes in ui of azure portal.. we are not able to edit pipeline query manually. Is there any alternate way to edit pipeline query manually ??
I tried it and pipeline still could be edit now.
I created a copy active in Data Factory v1.
Choose the Monitor&Manage action in Data Factory Overview.
Edit the pipeline manually: AUTHOR--->Resource exploer---> right click pipeline/dataset--->edit
Hope this helps.

Use Azure Functions as custom activity in ADFv2

Is it possible to somehow package and execute already written azure function as a custom activity in azure data factory?
My workflow is next:
I want to use azure function (which is doing some data processing) in ADF pipeline as a custom activity. This custom activity is just one of the activities in pipeline but its key to be executed.
Is it possible to somehow package and execute already written azure
function as a custom activity in azure data factory?
As I know, there is no way to do that so far. In my opinion, you do not need to package the Azure Function. I suggest you using Web Activity to invoke the endpoint of your Azure Function which could merge into previous pipeline nicely.

Use CosmosDB Database Triggers with Azure Data Factory Copy Activity

I have a ADF copy activity copy rows of data from Azure SQL to Azure Cosmos DB.
I have a need to manipulate the document generated. I wrote the logic for the same inside a Pre Create Database Trigger that gets executed whenever a new document is created.
The trigger is not getting executed.
I was not able understand what the problem is, couldn't find any documentation either. The Cosmos DB client API's to create document needs the trigger to execute to be specified explicitly. Not sure if something similar could be done for ADF copy activity as well. Please help.
I am trying to avoid writing a custom activity (so as to leverage built-in scaling and error handling capabilities).
This seems similar to Azure cosmos db trigger, but the answers are not applicable to this question.

Resources