1
votes

I have made this pipeline in Azure Data Factory that copies data from a Azure Storage Table to a Azure SQL database Table.

The Azure storage table is given data from a Javascript chatbot that records answers and stores them in the table. I would like to trigger the CopyTabletoSQL through my javascript app once all of the answers have been recorded.

This is my CopyTableToSQL pipeline object.

{
"name": "CopyTabletoSQL",
"type": "Copy",
"policy": {
    "timeout": "7.00:00:00",
    "retry": 0,
    "retryIntervalInSeconds": 30,
    "secureOutput": false
},
"typeProperties": {
    "source": {
        "type": "AzureTableSource"
    },
    "sink": {
        "type": "SqlSink",
        "writeBatchSize": 10000
    },
    "enableStaging": false,
    "dataIntegrationUnits": 0
},
"inputs": [
    {
        "referenceName": "tableInputDataset",
        "type": "DatasetReference"
    }
],
"outputs": [
    {
        "referenceName": "OutputSqlTable1",
        "type": "DatasetReference"
    }
]
}

Is there any way to have this execute from a javascript app? The docoumentation (https://docs.microsoft.com/en-us/azure/data-factory/concepts-pipeline-execution-triggers) only mentions .net, Powershell, REST API and Python SDK but nothing for node.js

2
I have managed to use docs.microsoft.com/en-us/rest/api/datafactory/pipelines/… to create a run and try it and it was succesfull. POST -URL- Authorization: Bearer -random symbols- Content-type: application/json How would I go about implementing this into my javascript app so that I can call on it at the end of a run of my app? Many thanks!BergBerg

2 Answers

1
votes

Azure Data Factory nodejs sdk is not supported so far. Based on your description, you already have created pipeline in your adf account.You could use Azure Data Factory Pipelines - Create Run REST api to execute it.

In this process, you need to generate Authorization token in Headers. You could refer to ADAL nodejs sdk to generate token.

Before that, you need to grant adf permission to your ad app.

enter image description here

enter image description here

Hope it helps you.

0
votes

You could call rest api in JavaScript.