Hi all, wondering if there is a way to fetch all u...
# troubleshoot
p
Hi all, wondering if there is a way to fetch all upstreams of a given entity (not just the first "level") using either the REST or graphql API
g
There is no way to do this via Rest @plain-farmer-27314. Via graphql, you can fetch a fixed number- for example, on the lineage graph we fetch two layers. However, you cannot fetch an unbounded number of layers via graphql.
p
Gotcha! That should be fine for our use case. I'll poke around in the networking tab and see if I can find an example
thank you 1
So I tried using:
Copy code
relationships(input: {types: ["Contains"], direction: OUTGOING, start: 0, count: 100}) {
      total
      relationships {
        entity {
          urn
        }
      }
    }
But this only returns the first "level" of upstreams (charts in this case). Take for instance a Looker dashboard, can I query for tables that are upstream of it?
b
Hey hey! You should be able to...
How about this?
Copy code
relationships(input: {types: ["Contains"], direction: OUTGOING, start: 0, count: 100}) {
      total
      relationships {
        entity {
          urn
          ... on Chart {
              relationships(input: {types: ["Consumes"], direction: OUTGOING, start: 0, count: 100}) {
                  total
                  relationships {
                     entity {
                        urn
                     }
                   }
                 }
            } 
        }
      }
    }
You get the point 🙂 You can nested relationship calls to traverse multiple edges!
p
Awesome, thanks! Is there a place I can find all of the valid values for the types: field? I see contains/consumes
g
b
DownstreamOf is used in context of Dataset->Dataset relationships Consumes is used in the context of Chart->Dataset relationships Contains is used in the context of Dashboard->Chart IsPartOf is used in the context of DataJob->DataFlow
👍 1