azure-data-factoryazure-synapseazure-mapping-data-flow

ADF Mapping Dataflow Temp Table issue inside SP call


I have a mapping dataflow inside a foreach activity which I'm using to copy several tables into ADLS; in the dataflow source activity, I call a stored procedure from my synapse environment. In the SP, I have a small temp table which I create to store some values which I will later use for processing a query.

When I run the pipeline, I get an error on the mapping dataflow; "SQLServerException: 111212: Operation cannot be performed within a transaction." If I remove the temp table, and just do a simple select * from a small table, it returns the data fine; it's only after I bring back the temp table that I get an issue.

Have you guys ever seen this before, and is there a way around this?


Solution

  • So after running some tests around this issue, it seems like Mapping Dataflows do not like Temp Tables when I call my stored procedure.

    The way I ended up fixing this was that instead of using a Temp Table, I ended up using a CTE, which believe it or not, runs a bit faster than when I used the Temp Table.

    @KarthikBhyresh

    I looked at that article before, but it wasn't an issue with the sink, I was using Synapse LS as my source and a Data Lake Storage as my sink, so I knew from the beginning that this did not apply to my issue, even though it was the same error number.