Search code examples
master-data-services

MDSModelDeploy "The name already exists." error using deployupdate


I am using Master Data Services and facing problem of "The name already exists. Type a different name."

I successfully created package and cloned model to Test environment(MDS2) from Dev(MDS1).

MDSModelDeploy createpackage -model MASTER_DATA_EDW -service MDS1 -package MasterDataEDW_NoData_D_231204.pkg

MDSModelDeploy deployclone -package MasterDataEDW_NoData_D_231204.pkg -service MDS2

Then changed data type of atribute in Dev env in one entity and want to make update, which fails.

enter image description here

Then tried to find out what name already exists by joining Dev MDS through linked server.

SELECT t2ent.MUID as TEST_ENTITY_MUID, dent.MUID as DEV_ENTITY_MUID, t2ent.Name AS TEST_ENTITY,dent.Name AS DEV_ENTITY, t2att.Name AS TEST_ATT_NAME, datt.Name AS DEV_ATT_NAME, t2att.MUID AS TEST_ATT_MUID, datt.MUID AS DEV_ATT_MUID
FROM mdm.tblEntity t2ent 
inner join mdm.tblModel model on model.ID = t2ent.Model_ID and model.Name = 'MASTER_DATA_EDW'
left join mdm.tblAttribute t2att on t2ent.ID = t2att.Entity_ID
full outer join MDS_DEV.MDS.mdm.tblEntity dent on dent.MUID = t2ent.MUID 
full outer join MDS_DEV.MDS.mdm.tblAttribute datt on dent.ID = datt.Entity_ID
                                        and t2att.Name = datt.Name
where (t2att.TableColumn like 'uda%' or t2att.TableColumn in ('Name', 'Code'))
and (t2att.DataTypeInformation != datt.DataTypeInformation
or t2att.DataType_ID != datt.DataType_ID
or t2att.AttributeType_ID != datt.AttributeType_ID
or t2att.DisplayName != datt.DisplayName
or t2att.Name != datt.Name
or t2att.Description != datt.Description
or t2att.MUID != datt.MUID
or datt.MUID is null
)

I saw a change(different MUID on same attribute), so i tried to update MUID of attribute in TEST env to dev MUID so it match and update. Didnt work.

Next i reversed my datatype change on dev env and tried to update if its working after making it again same. Didnt work, its somehow not same. The only thing what works, is to delete attribute on test env and then update, which creates attribute once again.

I have problem to change name or datatype of any attribute. It looks like it wants to create new attribute with same name and new datatype while there is still old one, instead of updating .

But when i am facing this problem when i dont know what attribute is updated, i have no clue how to fix it, even my T-SQL script says nothing has changed. Any ideas? I cant delete/clone it.


Solution

  • As it was said in the description, based on T-SQL script, there was no problem with attributes, entities or models. They are same.

    I've found ..\Master Data Services\Configuration\Logs directory where are logs with exact problem with update.

    Cannot insert duplicate key in object mdm.tblModelVersionFlag

    In my opinion, Flag on destination environment was created after cloning Model. Solution was to update destination FlagID to source FlagID like

    update mdm.tblModelVersionFlag  
    set MUID = <SOURCE_FLAG_ID>
    where MUID = <DESTINATION_FLAG_ID>