Interpreting Script activity output json with Azure Data Factory\Synapse analytics
Script activity in Azure Data Factory\ Synapse analytics is very helpful to run queries against data sources mentioned here in this document.
When we use two or more queries in the script activity, it is important to understand the output json of script activity to write expressions based on the output in the subsequent activities.
Consider the below Pipeline design:
We have two select queries as follows in script activity, and each of which will give a resultSet.
select top 2 * from tbl_adf;
Select * from tbladf
When debugged, it will give output as below.
So, as per line #2, resultSet count =2. It is because, we have two select queries in the script activity.
In case we want to get the Total Revenue value from Row#1, we have to write below expression.
@activity('Script1_copy1').output.resultSets[0].rows[0]['Total Revenue']
where, resultSets[0]: First select query result
rows[0]: first row in resultSets[0]
Same way, if we want to get the Total Revenue value from Row#2, we have to write below expression.
@activity('Script1_copy1').output.resultSets[0].rows[1]['Total Revenue']
where, resultSets[0]: First select query result
rows[1]: second row in resultSets[0]
And, the below expression gets the rowcount from each resultset.
@activity('Script1_copy1').output.resultSets[0].RowCount
@activity('Script1_copy1').output.resultSets[1].RowCount
So, by understanding the structure of output json, we are able to write expressions to access individual elements of the output of any activity in ADF\Synapse.
Published on:
Learn moreRelated posts
Azure Toolkit for IntelliJ: Introducing the enhanced Java Code Quality Analyzer!
Discover the latest updates to the Azure Toolkit for IntelliJ, featuring an enhanced Java Code Quality Analyzer to help you write cleaner, saf...
Azure Boards + GitHub: Recent Updates
Over the past several months, we’ve delivered a series of improvements to the Azure Boards + GitHub integration. Whether you’re tracking...
Introducing the Azure MCP Server
This post introduces the Azure MCP Server, bringing the power of the cloud to your AI agents. The post Introducing the Azure MCP Server appear...
Azure OpenAI Service now authorized for all U.S. Government data classification levels
In the coming years, artificial intelligence will continue to be foundational to technical innovations for national security missions. Already...
GPT-4.1 is now available at Azure AI Foundry
Azure AI Foundry and AOAI (Azure OpenAI Services) keeps on getting better all the time! The latest addition in Azure AI Foundry (as of April 1...
Introducing Region Selection in Azure Cosmos DB Data Explorer for NoSQL Accounts
You asked—we delivered! Users can now manually select the region Data Explorer sends requests to! When you use Entra Authentication with NoSQL...
Microsoft Attempts to Fix Microsoft Graph PowerShell SDK Problem with Azure Automation
V2.26 and V2.26.1 of the Microsoft Graph PowerShell SDK were low-quality, buggy disasters. Microsoft aims to fix the problem in the next versi...