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?
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
@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 :

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.