Hi! I'm trying to query via `GraphQL` the `lineage...
# getting-started
a
Hi! I'm trying to query via
GraphQL
the
lineage
of degree 1 for all
datasets
within a specific
container
. I'm no expert on GraphQL so any help is much appreciated 🙂 Here is my query so far:
Copy code
{
  searchAcrossLineage(
    input: {
      types: DATASET, 
      direction: UPSTREAM, 
      orFilters: [
        {
        and: [
          {
            field: "degree", 
            values: "1"
          }
          {
            field: "container"
            values: ["urn:li:container:xxxxxxxxxxx"]
            condition: EQUAL
            negated: false
          }
        ]
        }
      ]
    }
  ) {
    searchResults {
      degree
      entity {
        ... on Dataset {
          name
          platform {
            name
          }
        }
      }
    }
  }
}
g
I don’t think
searchAcrossLineage
or any other GQL method will support lineage getting lineage for all datasets or group of datasets in a container. one approach get all URNs in the container, loop through each urn to retrieve lineage here GQL query to get lineage for different degree
Copy code
query getAllLineageEntities($input: SearchAcrossLineageInput!) {
  searchAcrossLineage(input: $input) {
    ...searchAcrossRelationshipResults
    __typename
  }
}

fragment searchAcrossRelationshipResults on SearchAcrossLineageResults {
  start
  count
  total
  searchResults {
    entity {
      ...searchResultFields
      ... on Dataset {
        __typename
      }
      __typename
    }
    degree
  }
}

fragment searchResultFields on Entity {
  urn
  type
  ... on Dataset {
    name
    platform {
      ...platformFields
      __typename
    }
    properties {
      name
    }

    ownership {
      ...ownershipFields
      __typename
    }
    
  }

  ... on Dashboard {
    dashboardId
    properties {
      name
    }
      ownership {
      ...ownershipFields
      __typename
    }
    __typename
  }
  ... on Chart {
    chartId
    properties {
      name
    }
    ownership {
      ...ownershipFields
      __typename
    }
    __typename
  }


  ... on Container {
    properties {
      name
    }
    ownership {
      ...ownershipFields
      __typename
    }
    subTypes {
      typeNames
    }

  }
  ... on DataPlatform {
    ...nonConflictingPlatformFields
  }

}

fragment platformFields on DataPlatform {
  urn
  type
  name
  properties {
    type
    displayName
  }
  displayName
  __typename
}

fragment nonConflictingPlatformFields on DataPlatform {
  urn
  type
  name
  properties {
    displayName
    __typename
  }
  displayName
  __typename
}

fragment ownershipFields on Ownership {
  owners {
    owner {
      ... on CorpUser {
        urn
        type
        username
    }
  }
}
}
input:
Copy code
{
  "input": {
    "urn": "<entity_urn>",
    "direction": "DOWNSTREAM",
    "types": [],
    "query": "",
    "start": 0,
    "count": 1000,
    "orFilters": [
      {
        "and": [
          {
            "field": "degree",
            "condition": "EQUAL",
            "negated": "false",
            "values": [
              "1",
              "2",
              "3+"
            ]
          }
        ]
      }
    ]
  }
}
thanks bear 1
a
Thanks! Good idea
r
Pablo- did this solve your issue? Sending a DM to see if there's anything else you might need assistance with.