Hi I'm Srija, Solutions Consultant here at Ataccama.
In this post, we can see a workaround for changing the stewardship for out-of-the-box rules and terms along with the project related business terms and rules. This workaround helps to transfer the stewardship of business rules and terms to ‘Organization’ without causing the API error.
How to perform the transfer of stewardship?
- ONE web application
- By creating a custom plan to change stewardship for multiple business terms and rules.
How to create a custom plan to bulk change stewardship for business terms and rules?
- In ONE desktop, you can use metadata reader steps from term or rule, and you can join with group metadata reader using stewardship name and name.
- In the JSON step, use the below GraphQL query to change the stewardship for terms or rules.
{"query":"mutation TransferStewardship_rule($gid: GID!, $newStewardId: GID, $accessLevelForPreviousSteward: String) {
ruleTransferStewardship(
gid: $gid
newStewardId: $newStewardId
accessLevelForPreviousSteward: $accessLevelForPreviousSteward
) {
success
__typename
}
}",
"variables":{
"gid": "#ruleid#",
"newStewardId": "#groupid#",
"accessLevelForPreviousSteward": "viewMetadata"
}
}
- If we try to change the stewardship in Ataccama 14.5 version for the few out-of-the-box rules or terms – it throws an API error shown below. It is a known obstacle we are working on. In the meantime, we would like to share a few tips on how to workaround it.
To resolve this error, we can use the following steps:
- Connect to your database
- Take the backup of the existing role mapping table using the query below.
create table "_RoleMapping_backup"
(
like "_RoleMapping" including all
);
insert into "_RoleMapping_backup"
select *
from "_RoleMapping";
- This query has two parts. Execute the first part- to report on how many missing records and how many records need adjustment for stewardship changeRun the second part to change the stewardship.
Part 1:
-- both queries will start with this common prefix
-- it will follow by one or the other part as commented below
with data as (select id_i, type_i, path_i, stewardship_ri
from source_q
where kind_i in ('p', 'pc', 'pd', 'hd')
and stewardship_ri is not null
union all
select id_i, type_i, path_i, stewardship_ri
from location_q
where kind_i in ('p', 'pc', 'pd', 'hd')
and stewardship_ri is not null
union all
select id_i, type_i, path_i, stewardship_ri
from folder_q
where kind_i in ('p', 'pc', 'pd', 'hd')
and stewardship_ri is not null
union all
select id_i, type_i, path_i, stewardship_ri
from "catalogItem_q"
where kind_i in ('p', 'pc', 'pd', 'hd')
and stewardship_ri is not null
union all
select id_i, type_i, path_i, stewardship_ri
from rule_q
where kind_i in ('p', 'pc', 'pd', 'hd')
and stewardship_ri is not null
union all
select id_i, type_i, path_i, stewardship_ri
from term_q
where kind_i in ('p', 'pc', 'pd', 'hd')
and stewardship_ri is not null
union all
select id_i, type_i, path_i, stewardship_ri
from "lookupItem_q"
where kind_i in ('p', 'pc', 'pd', 'hd')
and stewardship_ri is not null
union all
select id_i, type_i, path_i, stewardship_ri
from "monitoringProject_q"
where kind_i in ('p', 'pc', 'pd', 'hd')
and stewardship_ri is not null
union all
select id_i, type_i, path_i, stewardship_ri
from "policy_q"
where kind_i in ('p', 'pc', 'pd', 'hd')
and stewardship_ri is not null
union all
select id_i, type_i, path_i, stewardship_ri
from "reconciliationProject_q"
where kind_i in ('p', 'pc', 'pd', 'hd')
and stewardship_ri is not null),
missing as (select 'missing' as reason,
d.*,
g."numericalIdentifier_s" as identity,
md.id as access_level
from data d
join "group_q" g on g.id_i = d.stewardship_ri
join "_MmdDictionary" md on md.type = 'ACCESS_LEVEL' and md.name = 'full'
where g.kind_i in ('p', 'pc', 'pd', 'hd')
and not exists(select 1
from "_RoleMapping" rm
where rm.md_node = d.id_i
and rm.identity = g."numericalIdentifier_s")),
adjust as (select 'adjust' as reason,
d.*,
g."numericalIdentifier_s" as identity,
md.id as access_level
from data d
join "group_q" g on g.id_i = d.stewardship_ri
join "_MmdDictionary" md on md.type = 'ACCESS_LEVEL' and md.name = 'full'
where g.kind_i in ('p', 'pc', 'pd', 'hd')
and exists(select 1
from "_RoleMapping" rm
where rm.md_node = d.id_i
and rm.identity = g."numericalIdentifier_s"
and rm."accessLevel" != md.id))
-- use this part to find out what will need to be performed
-- it just selects, does not do any inserts/udpates
select *
from missing
union all
select *
from adjust;
Part 2:
-- use this part to actually insert/select everything
-- comment out the previous 5 lines
-- note that the comma on the next line is not a typo, it continues in the list of definitions of CTEs
,
inserts as (
insert into "_RoleMapping" (path, type, md_node, "accessLevel", identity)
select path_i, type_i, id_i, access_level, identity
from missing
returning 'missing' as reason, md_node, identity),
updates as (
update "_RoleMapping" rm
set "accessLevel" = a.access_level
from adjust a where a.id_i = rm.md_node and a.identity = rm.identity
returning 'adjust' as reason, md_node, rm.identity)
select *
from inserts
union all
select *
from updates;
The stewardship issue for the out-of-the-box rules and terms can be fixed using the above queries.
If you have any questions or thoughts please share them in the comments below!