Synapse pipline dataflow truncate and insert

IJH 1 Reputation point
2022-03-04T10:02:16.343+00:00

I have a pipline in Synapse that only excecutes a dataflow. The dataflow has a Sink that is supposed to truncate the table and the insert new data. I have tried both to use Pre SQL script, and to use the table action. If the table is empty before I execute the pipeline the table becomes populated, but if the table is allready populated when I execute the pipeline the table only becomes truncated and no data is written. Has anyone had the same problem and solved it? If so, pleas reach out :)

180045-skjermbilde.png

179997-image.png

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
5,373 questions
{count} votes

2 answers

Sort by: Most helpful
  1. AaronHughes 396 Reputation points
    2022-03-04T16:57:02.67+00:00

    Personally I would have a control pipeline that ran the truncate table statement in a stored proc with a parameter passthrough and internal user that has the permissions on the db to alter, then a wait to ensure it is clean and ready to move on to the data flow load task.

    0 comments No comments

  2. AnnuKumari-MSFT 34,556 Reputation points Microsoft Employee Moderator
    2022-03-10T06:45:43.24+00:00

    Hi @IJH ,

    Thankyou for using Microsoft Q&A platform and posting your query.

    As I understand your query , it seems like you are trying to truncate the destination table before the data load using Data Flow. In the sink transformation , you have tried to use both the approaches- using table action as 'Truncate table' as well as using Pre SQL scripts to write SQL query to truncate table before load. However, it is not working as expected. Please correct me if my understanding is wrong.

    Please check the table schema and columns in the destination is same as the source columns .

    Sharing the video for reference where I tried to reproduce your issue . For that, I used both options to truncate the table and reload the data. I didn't find any issue . It worked as expected for me.
    181743-truncatereload.gif

    Hope this will help. Please let us know if any further queries.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you.
      Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators

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.