Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DG-1746 Support custom relationshipDef for any Assets linking #3479

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

nikhilbonte21
Copy link

@nikhilbonte21 nikhilbonte21 commented Sep 6, 2024

Change description

Hagerty (Customer) wants a way to define custom objects that are built on top of Atlan’s Assets interface, create custom definitions for relationships between 2 arbitrary assets and want some properties on the relationship as well.

Overall we try to keep it very generic to make it GA.


Type of change

  • Bug fix (fixes an issue)
  • New feature (adds functionality)

Related issues

DG-1746 Support custom relationshipDef for any Assets linking

Checklists

Development

  • Lint rules pass locally
  • Application changes have been tested thoroughly
  • Automated tests covering modified code pass

Security

  • Security impact of change has been considered
  • Code follows company security practices and guidelines

Code review

  • Pull request has a descriptive title and context useful to a reviewer. Screenshots or screencasts are attached as necessary
  • "Ready for review" label attached and reviewers assigned
  • Changes have been reviewed by at least one other contributor
  • Pull request linked to task tracker where applicable

if (map.containsKey(AtlasRelatedObjectId.KEY_RELATIONSHIP_ATTRIBUTES) && !map.containsKey(AtlasRelatedObjectId.KEY_RELATIONSHIP_TYPE)) {
return false;
}

if (guid != null && StringUtils.isNotEmpty(guid.toString())) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sample

"appendRelationshipAttributes": {
                "userDefRelationshipTo": [
                    {
                        "guid": "6549985b-b6cc-430f-9042-cbb515847536",
                        "typeName": "Table",
                        "relationshipType": "UserDefRelationship",
                        "relationshipAttributes": {
                            "attributes": {
                                "toType": "Classifiedby",
                                "fromType": "Isa"
                            }
                        }
                    }
                ],
}

relationshipAttributes.put("attributes", relationship.getAttributes());
ret.getAttributes().put("relationshipAttributes", relationshipAttributes);
}
}
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sample

 {
            "typeName": "Table",
            "attributes": {
                "userDefRelationshipTo": [],
                "qualifiedName": "target_table_qualified_name",
                "name": "target_table",
                "userDefRelationshipFrom": [
                    {
                        "guid": "8762fc1f-c10c-4caf-9539-ea529a936f4c",
                        "typeName": "Table",
                        "attributes": {
                            "relationshipAttributes": {
                                "typeName": "UserDefRelationship",
                                "attributes": {
                                    "toType": "classifiedBy",
                                    "fromType": "isA"
                                }
                            },
                            "name": "source_table"
                        },
                        "uniqueAttributes": {
                            "qualifiedName": "source_table_qualified_name"
                        }
                    }
                ]
            },
            "guid": "de28c2a9-0ce3-48b3-83d4-3998187e13a6",
            "status": "ACTIVE",
            "displayText": "target_table",
            "classificationNames": [],
            "classifications": [],
            "meaningNames": [],
            "meanings": [],
            "isIncomplete": false,
            "labels": [],
            "createdBy": "service-account-atlan-argo",
            "updatedBy": "service-account-atlan-argo",
            "createTime": 1723215374293,
            "updateTime": 1723215374293
        }

Comment on lines 500 to 512
indexsearchMetric.addTag("utmTag", "other");
indexsearchMetric.addTag("source", "other");
for (String utmTag : parameters.getUtmTags()) {
if (TRACKING_UTM_TAGS.contains(utmTag)) {
indexsearchMetric.addTag("utmTag", utmTag);
break;
}
}
if (parameters.getUtmTags().contains(UTM_TAG_FROM_PRODUCT)) {
indexsearchMetric.addTag("source", UTM_TAG_FROM_PRODUCT);
}
indexsearchMetric.addTag("name", RELATIONSHIP_INDEXSEARCH_TAG_NAME);
indexsearchMetric.setTotalTimeMSecs(System.currentTimeMillis() - startTime);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check this with Suman

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can skip it for now, we have added this metric to track indexsearch only which is very important. Do you think this endpoint would be very important to track by utmTags?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not important now as we are not returning any asset with this API.
We only support aggregations which should never be stored as a search metric, we can add it later once this API supports returning assets

@nikhilbonte21 nikhilbonte21 changed the title Dg 1746 DG-1746 Support custom relationshipDef for any Assets linking Sep 6, 2024
Comment on lines 500 to 512
indexsearchMetric.addTag("utmTag", "other");
indexsearchMetric.addTag("source", "other");
for (String utmTag : parameters.getUtmTags()) {
if (TRACKING_UTM_TAGS.contains(utmTag)) {
indexsearchMetric.addTag("utmTag", utmTag);
break;
}
}
if (parameters.getUtmTags().contains(UTM_TAG_FROM_PRODUCT)) {
indexsearchMetric.addTag("source", UTM_TAG_FROM_PRODUCT);
}
indexsearchMetric.addTag("name", RELATIONSHIP_INDEXSEARCH_TAG_NAME);
indexsearchMetric.setTotalTimeMSecs(System.currentTimeMillis() - startTime);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can skip it for now, we have added this metric to track indexsearch only which is very important. Do you think this endpoint would be very important to track by utmTags?

sumandas0
sumandas0 previously approved these changes Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants