Developer forum

Forum » Integration » Deleting rows from unmapped entities

Deleting rows from unmapped entities

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

I have a data integration job with just one mapping: for EcomVariantOptions. I also have the option "Remove missing rows after import" turned on. Yesterday, the job failed (I think because I had a weird ID in my source) and then got the following error:

Job Failed with the following message: Failed to remove rows from Table [dbo.EcomLanguages] that where not present in source. Exception message: The DELETE statement conflicted with the REFERENCE constraint "EcomValidationGroupsTranslation_FKLanguageID". The conflict occurred in database "database", table "dbo.EcomValidationGroupsTranslation", column 'EcomValidationGroupsTranslationValidationGroupLanguageID'. The statement has been terminated. Sql query: DECLARE @r INT; SET @r = 1; WHILE @r > 0 BEGIN Delete top(100000) from [dbo].[EcomLanguages] where not exists (select * from [dbo].[EcomLanguagesTempTableForBulkImport] where ([dbo].[EcomLanguages].[LanguageId]=[LanguageId] or ([dbo].[EcomLanguages].[LanguageId] is null and [LanguageId] is null)) ) SET @r = @@ROWCOUNT; END

Why is it trying to deleted from Languages even though these aren't mapped? That looks very scary to me.

Imar


Replies

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply
This post has been marked as an answer

Hi Imar,
that is a weird bug in the EcomProvider. It happens because when you have the column with LanguageId in the mapping it tries to find the language by its name or code or language id in the EcomLanguages and if it doesn't find the existing language it adds a new language to the temporary table for EcomLanguages, and then if the table has data the mapping for that table is auto-added and then this mapping is processed as a real mapping so the values are inserted to the main table and finally missed rows are removed (because of  "Remove missing rows after import" turned on).
I'll try to fix it asap.
BR, Dmitrij

Votes for this answer: 1
 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Interesting, thanks for the explanation. We solved it for now by making sure we only get valid IDs so there's no immediate need for a fix for us.

Thanks!

Imar

 
Kristian Kirkholt Dynamicweb Employee
Kristian Kirkholt
Reply

Hi Imar

Notice this has been fixed in Dynamicweb release 9.12.3

Kind Regards
Dynamicweb Support
Kristian Kirkholt

 

You must be logged in to post in the forum