Azure-docs: Drop/Truncate table in pre-copy script with foreign keys and concurrent connections

Created on 24 Sep 2019  Â·  5Comments  Â·  Source: MicrosoftDocs/azure-docs

Will this approach automatically sequence tables based on the presence of foreign keys for drop or truncating a table in pre copy script? When there are concurrent connections, don't we run into reference errors?


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri2 cxp data-factorsvc product-question triaged

All 5 comments

@nagasandeep Yes, it will automatically approach tables in sequence if you assign the value of "isSequential" to "true". To do so, you can check the "Sequential" checkbox under the settings tab of the ForEach activity as shown below :

image

Each iteration of the ForEach activity is then only executed once the previous one is complete.

The pre-copy script is something that is executed just before starting the copy activity.

Hence, concurrency is not an issue.

Ref- https://docs.microsoft.com/en-us/azure/data-factory/control-flow-for-each-activity

No, thats not what I meant. Here in the pre-copy script we are truncating the table.

Say there are two tables A and B, B references to a column in A, then the truncate of A fails due to foreign key constraint.

This approach will fail for the regular task of mirroring data when there are constraints.
Please provide a mechanism to enable/disable constraints in pre-copy script.

@nagasandeep In that corner case, it might fail.

Since it's a product feedback, I would recommend you to provide feedback at the feedback forum.. All the feedback you share, is closely monitored by the Data Factory Product team and implemented in future releases.

I will now proceed to close this issue. Please feel free to still comment and tag me if you have any queries.

@nagasandeep I'm looking for this functionality too

@ChiragMishra-MSFT Is there a recommended pattern clear data out of tables before a copy?

@ahahn95 I ended up disabling all the constraints on the database before executing the pipeline and then enabled them again.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

renattomachado picture renattomachado  Â·  42Comments

Sudharma picture Sudharma  Â·  48Comments

m-andersen picture m-andersen  Â·  65Comments

smcd253 picture smcd253  Â·  44Comments

DanijelMalik picture DanijelMalik  Â·  82Comments