Hello everyone!
With this post, I wanted to go through a use case that I found a solution for that may help others, so I thought I’d share. The goal with this is to assign DQ checks to Monitoring Projects using a ONE API call instead of doing it manually. I’m going to assume the following: that you’ve already made monitoring project and DQ rules you’re interested in, and a catalog item has already been added to the monitoring project.
The GraphQL query will be a mutation that applies the DQ check to your attribute. It will use variables to indicate where this check should be applied. I’ll explain where to get all of these variables below
The last section will briefly go through how to run the queries using Ataccama Playground.
Query to Apply DQ Check
The query used to apply the DQ check is provided in the file mutation SaveEntity_projectCatalogItemInstance.txt and the variables which will be necessary to include for this query to work, are in the mutation variables.txt file.
In the variables text file, you must replace the following with the appropriate ids:
- “MONITORING PROJECT TABLE ID”
- “RULE ID”
- “CATALOG ITEM ATTRIBUTE ID”
- “RULE INPUT ATTRIBUTE ID”
The above each correspond to an id that you will provide to indicate where and what should be added for this DQ check. Below are procedures to finding these values.
Monitoring Project Table ID
The monitoring project table id is the id of the catalog item configuration in the monitoring project (not the catalog item itself).
To get this id, go to the monitoring project you’d like to add the DQ check to, go to Configuration & Results, then click into the catalog item. The id will be the last part of the url for this page (that follows /items/).
Rule ID
The rule id is acquired from the URL of the page of the rule itself. Go to DQ Evaluations Rules, go to the rule you would like to add, then copy the last part of the URL in that rule’s Overview page.
Catalog Item Attribute ID
This id corresponds to the attribute of the catalog item in the monitoring project that you would like to add the rule to. Go to the catalog item itself, find the attribute that requires the DQ check under Attributes, click into it. The last part of this page’s URL will be used for this id.
Rule Input Attribute ID
Every DQ rule has an input in its implementation. The catalog item’s attribute, selected in the previous step, will be mapped to the input of the DQ rule to be processed in the rule’s logic.
This id can be acquired through the use of another GraphQL query that reads the metadata of the rules in our environment. A filter can be used for this query to filter for only the rule we are interested in, to simplify the response, which will make it easier to find our Rule Input Attribute ID.
The query is included in the file query GetRules and the necessary variables for this query are in query variables. In the variables, you must replace “RULE NAME” with the name of the rule you’d like to get the Rule Input Attribute ID from.
The response should look like this:
Where the list of inputs for the rule, and each inputs name and id should be in the red box. Copy the gid for the input you would like to map the attribute to, and paste it in the variables for the mutation query to apply the DQ check.
Running the Queries in Playground
Running the queries is straightforward. Go to your environment’s playground page (example: https://example.dev.ataccama.online/playground/). Paste the query/mutation in the box at the top, and then include your variables, with the proper ids and filters in the box at the bottom:
Ensure for the variables you click on the tab Query Variables (middle box above). It is assumed your authentication to run these commands is already set up in the HTTP Headers tab. The response will be displayed to the right of your query and variables.
I hope this was helpful for others, let me know if you have any questions!