Azure Data Factory Pipeline Expression Builder syntax

Todd Moyer 0 Reputation points
2024-02-26T19:31:58.0733333+00:00

The Azure Data Factory Pipeline Expression Builder (PEB) obviously has a syntax, presumably based on a programming language. However, I can't find any reference on what is legal syntax or how to contruct interesting expressions. For example, let's say we wanted to break a string into tokens, then process and join those tokens into a new string. That would involve an array or list, but what's the syntax for an array slice? So what is the basis for the PEB's syntax? Is there a reference beyond that for individual functions? One could hack away with trial and error, but presumably there's something better.

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
10,521 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Vahid Ghafarpour 21,080 Reputation points
    2024-02-26T23:41:42.7033333+00:00

    May this article help you:

    https://learn.microsoft.com/en-us/azure/data-factory/control-flow-expression-language-functions

    ** Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful **


  2. Smaran Thoomu 14,300 Reputation points Microsoft Vendor
    2024-02-28T09:17:48.6066667+00:00

    Hi @Todd Moyer ,

    Thank you for your question about the Azure Data Factory Pipeline Expression Builder syntax. The Pipeline Expression Builder (PEB) is a domain-specific language used to define expressions in Azure Data Factory pipelines. The syntax for the PEB is based on the Azure Data Factory expression language, which is similar to the syntax used in JSON.

    To construct interesting expressions using the PEB, you can use a combination of column values, parameters, functions, operators, and literals that evaluate to a Spark data type at run time. You can use the Expression Builder in mapping data flows in Azure Data Factory and Azure Synapse Analytics to build expressions interactively. The Expression Builder provides IntelliSense code completion for highlighting, syntax checking, and autocompleting, making it easy to build data flows.

    Regarding your question about array slice, you can use the slice function in the expression language to extract a subset of an array. The syntax for the slice function is as follows:

    slice(array, start, length)
    

    Where:

    • array is the input array.
    • start is the starting index of the slice. If start is negative, it represents an offset from the end of the array.
    • length is the length of the slice. If length is negative, it represents the number of elements to exclude from the end of the array.

    For example, to extract the first three elements of an array, you can use the following expression:

    slice(myArray, 0, 3)
    

    Regarding the syntax of the expression language, it is based on the JSON syntax and is similar to other programming languages such as JavaScript and Python. The expression language supports a wide range of operators, functions, and data types, which are documented in the Azure documentation on "Expressions and functions in Azure Data Factory".

    I hope this helps. Do let us know if you any further queries.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.