Hi! not sure this is the right place to ask so ple...
# advice-metadata-modeling
s
Hi! not sure this is the right place to ask so please direct me to the right channel if appropriate. I want to find which tables on mysql databases contain either the field
player_uid
or
player_id
. This is fairly easyto do as shown in the screenshot. Problem is I’d also like to know the type, i.e. is
player_id
a number or a string. I came up with a GQL query for this:
Copy code
{
  search(input: {type: DATASET, query: "player_uid", start: 0, count: 10}) {
    start
    count
    total
    searchResults {
      entity {
        urn
        type
        ... on Dataset {
          name
          schemaMetadata {
            fields {
              fieldPath
              type
            }
          }
        }
      }
    }
  }
}
the only issue is it shows ALL the fields in the table and I’d like to have only the one called
player_id
OR
player_uid,
anyone knows if this is possible?
b
i think this depends on what version your datahub is on. v0.9 onwards has advanced search fuctionality and so the syntax is slightly different
s
thx for replying @better-orange-49102, I’m on v0.10.0
b
this query returns results for me -> i tried it on the demo website -> but i think the search is glitched @astonishing-answer-96712 this query in graphql and the query i do using UI do not match the same number of results (reference our previous conversation https://datahubspace.slack.com/archives/CV2KB471C/p1675907821500209)
Copy code
query test{
  searchAcrossEntities(input:{
    types: DATASET
    query: "*"
    orFilters:[
      {and: [{field: "fieldPaths" condition: CONTAIN values: ["state_name"], negated: false}]}
      {and: [{field: "fieldPaths" condition: CONTAIN values: ["siour"], negated: false}]}
    ]
  }){
    count
    searchResults{
      entity{
        ... on Dataset{
          urn
        }
      }
    }
  }
}
ie graphiql returns 10, but using the advanced search in UI, I return 3 listings
the orFilters is part of the advanced search that came in v0.9
s
I’m new to datahub, why is
searchAcrossEntities
needed?
b
hmm you can use
search
instead
just change
types
to
type
s
trying it
mmm i’m getting 18 results before it was 210..
but basically its a filter that require the
fieldPaths
to contain one of the names I’m looking for right?
b
yeah the filter works like that afaik. Maybe im not quite understanding the new syntax as well, I'm on 0.8.45 myself. perhaps @astonishing-answer-96712 can direct someone else to give a better informed reply.
query: "fieldsPath: X OR fieldsPath: Y"
without filters is working for me in v0.8.45(my own instance), but not in v0.10 (demo site)
a
Thank you xL! Yeah, we’re working on resolving this issue right now, here’s docs on the fieldPath schema: https://datahubproject.io/docs/advanced/field-path-spec-v2/#examples