Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Gambit 20 posts 100 karma points
    Feb 18, 2017 @ 04:14
    Gambit
    0

    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:

    1. dataProviderAlias
    2. primaryKey
    3. 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?

    Thank you

  • Richard Soeteman 4035 posts 12842 karma points MVP
    Feb 20, 2017 @ 07:25
    Richard Soeteman
    0

    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

  • Gambit 20 posts 100 karma points
    Feb 20, 2017 @ 13:46
    Gambit
    0

    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

  • Richard Soeteman 4035 posts 12842 karma points MVP
    Feb 20, 2017 @ 13:54
    Richard Soeteman
    0

    Then it will work since the primary key name is different. The value is the same in that case but that does not matter.

  • Gambit 20 posts 100 karma points
    Feb 20, 2017 @ 15:27
    Gambit
    0

    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

  • Richard Soeteman 4035 posts 12842 karma points MVP
    Feb 21, 2017 @ 07:34
    Richard Soeteman
    0

    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

  • Gambit 20 posts 100 karma points
    Feb 22, 2017 @ 09:59
    Gambit
    0

    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

  • Richard Soeteman 4035 posts 12842 karma points MVP
    Feb 22, 2017 @ 10:31
    Richard Soeteman
    0

    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

Please Sign in or register to post replies

Write your reply to:

Draft