wilson_smyth
wilson_smyth

Reputation: 1516

ADF mapping data flow only inserting, never updating

I have an ADF data flow that will only insert. It never updates rows. Below is a screenshot of the flow, and the Alter Row task that sets the insert/Update policies.

enter image description here data flow

enter image description here alter row task

There is a source table and a destination table. There is a source table for new data. A lookup is done against the key of the destination table. Two columns are then generated, a hash of the source data & hash of the destination data. In the alter row task, the policy's are as follows:

The Sink allows insert and updates:

enter image description here

Even so, on first run it inserts all records but on second run it inserts all the records again, even if they exist.

I think I am misunderstanding the process and so appreciate any expertise or advise.

Upvotes: 0

Views: 2508

Answers (2)

EqEdi
EqEdi

Reputation: 61

I tried simple dataflow structure for above problem. enter image description here Where source1 is my AzureSynapse table and Sink1 is Snowflake table.

for Alter row, I added keycolumn name : enter image description here if you have more than one column, you can provide comma separated list as well.

And added same column as enter image description here The Snowflake table have a unique constraint defined on column ID. With this, I am able to update as well as insert data in my final table.

Hope this helps you as well.

Upvotes: 0

NiharikaMoola
NiharikaMoola

Reputation: 5074

Thank you Joel Cochran for your valuable inputs, repro’d the scenario, and posting it as an answer to help other community members.

If you are using the upsert method in the sink, add alter row transformation with upsert if and write the expression for the upsert condition.

If you are using insert and update as your update method in the sink then in alter row transformation use both inserts if and update if conditions to insert and update data accordingly into the sink based on alter row conditions.

enter image description here

enter image description here

Upvotes: 0

Related Questions