Bradford1138
Bradford1138

Reputation: 93

ADF CopyData Is it possible to have a dynamic mapping that can be nullable?

I have a configuration table with tables names to copy data. Sometimes I want all the columns, so I don't have to specify the mapping. But sometimes, I only want some columns. Is it possible to have a mapping json null and CopyDAta activity will take all the columns?

ConfigurationTable

I tried to have the value nullable like that: enter image description here

But it throw an error when the value is null in the configurable table.

enter image description here

Is it possible?

Upvotes: 1

Views: 1640

Answers (1)

Scott Mildenberger
Scott Mildenberger

Reputation: 1607

You can use a default mapping if null in the table. From one of my Copy data activities with no mapping, it looks like

{
    "type": "TabularTranslator",
    "typeConversion": true,
    "typeConversionSettings": {
        "allowDataTruncation": true,
        "treatBooleanAsNumber": false
    }
}

In the Mapping it would look something like this (not verified), replace the value in <> with above or better yet store in a variable and use the variable there.

@json(if(equals(item()?TrustedMapping, null), <default>, item()?.TrustedMapping))

Upvotes: 1

Related Questions