Potential collisions for different import defenitions, but with the same primary key
Hello,
As I understand, CMSImport use the "DataSourceKey" field in DB to differentiate the records which should be updated, and which added.
This value consist of 3 parts:
dataProviderAlias
primaryKey
primaryKeyValue
If I set two different Import definitions which are using the
same Data Provider, but they are pointing into two different documents.
In this situation, one import's result will be updating the import result of another's import definition.
How can I avoid this situation? Do you have any "Best Practice" solution for this?
Sorry for misunderstanding, I mean different thing.
If we have 2 configured imports,
one from "abc.com" and the second from "xyz.com and
both of them have the same primary key column name "magic-key-id".
Don't think that that's possible because event kicks in later than creation of documents. What you could do is derive from the Dataprovider and change the primaryKeyname there. Dataproviders are located in
Potential collisions for different import defenitions, but with the same primary key
Hello,
As I understand, CMSImport use the "DataSourceKey" field in DB to differentiate the records which should be updated, and which added.
This value consist of 3 parts:
If I set two different Import definitions which are using the same Data Provider, but they are pointing into two different documents. In this situation, one import's result will be updating the import result of another's import definition.
How can I avoid this situation? Do you have any "Best Practice" solution for this?
Thank you
Hi,
Yes that is the downside of this solution. But what you can do is use a different primary key name then all should be ok.
Hope this helps,
Richard
Hi Richard,
And what to do in case if we have two imports with different external reference, but the same key - id?
How can we use another primary key?
Thank you
Then it will work since the primary key name is different. The value is the same in that case but that does not matter.
Hi Richard,
Sorry for misunderstanding, I mean different thing.
If we have 2 configured imports, one from "abc.com" and the second from "xyz.com and both of them have the same primary key column name "magic-key-id".
How to be in this case?
Thank you
Hi Gambit,
Then it will be an issue since all the keys are the same. No way to give xyz.com a different primary key name?
Best,
Richard
Hi Richard,
Regretfully it is not possible.
Can we somehow hijack (override) the primary key column name in the code?
Maybe subscribe on ImportProvider events and do something in the event handler?
Thank you
Hi,
Don't think that that's possible because event kicks in later than creation of documents. What you could do is derive from the Dataprovider and change the primaryKeyname there. Dataproviders are located in
CMSImportLibray.Providers.DataProviders
Hope you can use that.
Best,
Richard
is working on a reply...