Hi team. I’m having trouble working with `@Relatio...
# troubleshoot
l
Hi team. I’m having trouble working with
@Relationship
in datahub. Please see thread for details. Please advise.
One entity A we have defined the relationship as follows
Copy code
/**
  * Derived From Event Types
  */
   @Relationship = {
     "/*": {
        "name": "DerivesFrom",
        "entityTypes": [ "pinterestThriftEnumItem" ],
     }
   }
   derivesFromEventTypes: array[Urn] = []
When we specify the relationships like so
Copy code
mutation {
  updateEventDerivedMetric(urn: "urn:li:eventDerivedMetric:CLICKTHROUGH_TEST_123", 
    input: {
      name: "Clickthrough test 123",
      description: "description",
      derivesFromEventTypes: [         "urn:li:pinterestThriftEnumItem(ACCEPTED_CONTACT_REQUEST_WARNING_CLICK,EVENT_TYPE)",
      "urn:li:pinterestThriftEnumItem:(ACTIONED_USER_REPORT,EVENT_TYPE)"
      ]
  })
}
That works fine. And when we query the relationship on this entity like this:
Copy code
{
  eventDerivedMetric(urn: "urn:li:eventDerivedMetric:CLICKTHROUGH_TEST_123"){
    urn
    relationships(input: {types: ["DerivesFrom"], direction: OUTGOING}){
      relationships {
        entity {
          urn
        }
      }
    }
  }
}
It works and we get
Copy code
{
  "data": {
    "eventDerivedMetric": {
      "urn": "urn:li:eventDerivedMetric:CLICKTHROUGH_TEST_123",
      "relationships": {
        "relationships": [
          {
            "entity": {
              "urn": "urn:li:pinterestThriftEnumItem:(ACTIONED_USER_REPORT,EVENT_TYPE)"
            }
          },
          {
            "entity": {
              "urn": "urn:li:pinterestThriftEnumItem:(ACCEPTED_CONTACT_REQUEST_WARNING_CLICK,EVENT_TYPE)"
            }
          }
        ]
      }
    }
  }
}
Looks good. The problem comes when I query the relationship from the other entity using an
INCOMING
direction. So, using this query
Copy code
{
  pinterestThriftEnumItem(urn: "urn:li:pinterestThriftEnumItem:(ACTIONED_USER_REPORT,EVENT_TYPE)"){
    urn
    category
    relationships(input: {types: ["DerivesFrom"], direction: INCOMING}){
      relationships {
        entity {
          urn
        }
      }
    }
  }
}
I get
null
in the relationship
Copy code
{
  "data": {
    "pinterestThriftEnumItem": {
      "urn": "urn:li:pinterestThriftEnumItem:(ACTIONED_USER_REPORT,EVENT_TYPE)",
      "category": "EVENT_TYPE",
      "relationships": null
    }
  }
}
I expected to get an entity
urn:li:eventDerivedMetric:CLICKTHROUGH_TEST_123
under the
relationships
prop
e
Hi @late-helicopter-99742 I’m assuming you added a
dataFetcher
for relationships to the
PinterestThriftEnumItem
type?
this would be in
GmsGraphQLEngine.java
l
@echoing-airport-49548 thanks i think that worked. entity didn’t have a relationship resolver it seens
e
Glad to hear it!