BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Michael-K
Fluorite | Level 6

This year's challenge is to create a clone of an existing metadata folder(around 800 objects). I can adjust the attributes of the data objects (names, paths, etc.) using SAS code (metadata_getnasn, metadata_getnattr, metadata_setattr).

 

So far I have failed at exchanging user written transformations in DI jobs. I suspect that this is possible with the
"metadata_setassn" function, but I can't find the way exchanging the association.

 

Have anyone already made such replacements and can you give me a tip? Or is this not possible with SAS code?

 

I would be very grateful for a short feedback and a hint in which direction I could continue my research.

 

Warm greeting, Michael

1 ACCEPTED SOLUTION

Accepted Solutions
gwootton
SAS Super FREQ
I'm not intimately familiar with how DI Studio job contents translate into Metadata objects so you may be best served by examining your "Job_Clone" object using the Metabrowse to see how these objects associate with each other, but I think in Metadata this is more complicated than switching out a single association.
--
Greg Wootton | Principal Systems Technical Support Engineer

View solution in original post

4 REPLIES 4
gwootton
SAS Super FREQ
I'm not clear on what exactly you are trying to do, but the METADATA_SETASSN function is passed an two URIs, that of the object whose association is being modified, and the object being associated. It is additionally passed the name of the association and a modification (append, merge, modify, remove or replace).

So, if I had an object "Object A" associated with a single object "Object B" through association "Assocation1", and I wanted to replace this association to "Object B" with one to "Object C" I could use METADATA_SETASSN with the REPLACE or MODIFY mod:
metadata_setassn(object-a-uri,"Assocation1","REPLACE",object-c-uri);
This replaces the association1 to object b with an assocation1 to object c.

If I wanted to retain the object b association I could use APPEND or MERGE to add an association to object c.

If I have multiple objects associated with object A through association1 and I want to replace B with C and leave the rest, I would use a REMOVE using the object-b-uri and APPEND or MERGE with object-c-uri, or I could use REPLACE and pass all the existing URIs except object-b-uri, instead adding the object-c-uri.
--
Greg Wootton | Principal Systems Technical Support Engineer
Michael-K
Fluorite | Level 6

Thank you Greg for the quick reply. The explanations on how the functions "metadata_setassn" works are very helpful.

I'll try to create a little more understanding for our task with the following:

We need to clone (exportpackage  -> importpackge) about 850 DI Jobs that contain user written transformations (hereinafter referred to as UWT). After cloning, in the jobs the original UWTs must be exchanged for the cloned UWTs .

As an example: in the source, the “Table_Source” table in the “Job_Source” job is linked to the user-written transformation “UWT_Source”.

MichaelK_0-1740572248441.png

 

After cloning, the “Table_Clone” table, which has also been cloned, is still linked to the UWT “UWT_Source”

MichaelK_1-1740572248443.png

 

Now we are looking for a way to convert the connection of the table “Table_Clone” to the also cloned UWT “UWT_Clone” with SAS code

The aim should be

MichaelK_2-1740572248444.png

 

As the UWTs are identical, the options and mapping should also be retained when replacing them.

 

Based on your explanation, I hope to make progress with the metadata_setassn function.
I would be very grateful for any further information

Best regards, Michael

gwootton
SAS Super FREQ
I'm not intimately familiar with how DI Studio job contents translate into Metadata objects so you may be best served by examining your "Job_Clone" object using the Metabrowse to see how these objects associate with each other, but I think in Metadata this is more complicated than switching out a single association.
--
Greg Wootton | Principal Systems Technical Support Engineer
Michael-K
Fluorite | Level 6

In principle you are right, but it is about 330 jobs with 450 UWTs and 12200 mappings to be drawn manually.

 

The metadata browser and I are great friends, but the integration of UWTS in the job is really very complex . I think I will invest a few more hours in R&D 😁

 

Thanks again for your support

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

Get Started with SAS Information Catalog in SAS Viya

SAS technical trainer Erin Winters shows you how to explore assets, create new data discovery agents, schedule data discovery agents, and much more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 832 views
  • 2 likes
  • 2 in conversation