When I try the following GraphQL query: ```{ dat...
# getting-started
w
When I try the following GraphQL query:
Copy code
{
  dataset(urn: "urn:li:dataset:(urn:li:dataPlatform:cg,kv_entity,PROD)") {
    schemaMetadata {
      fields {
        fieldPath
      }
    }
  }
}
The response is an error message:
Copy code
{
  "errors": [
    {
      "message": "An unknown error occurred.",
      "locations": [
        {
          "line": 5,
          "column": 5
        }
      ],
      "path": [
        "dataset",
        "schemaMetadata"
      ],
      "extensions": {
        "code": 500,
        "type": "SERVER_ERROR",
        "classification": "DataFetchingException"
      }
    }
  ],
  "data": {
    "dataset": {
      "schemaMetadata": null
    }
  }
}
However, my GMS is running fine which I verified using the same dataset urn, but queried on ownership info, which worked. Could anyone help me understand what is wrong in my query. Basically I'm looking for GraphQL queries wherein: 1. Given a dataset URN and field path mention, the response gives list of all the field names. 2. field name is specified in query, and the response returns the names of all the datasets which have field with the matching name. 3. Glossary term is specified in the query and the response returns the names of all the fields (and datasets) to which the glossary term is tagged.
b
Hi there - when querying for schemaMetadata you must provide a schema version, where 0 represents the latest and -1 represents the second to last, next, etc
Did this work?
m
@witty-keyboard-20400 e.g. on demo.datahubproject.io/api/graphiql this query works
Copy code
{
  dataset(urn: "urn:li:dataset:(urn:li:dataPlatform:snowflake,demo_pipeline.public.all_entities,PROD)") {
    schemaMetadata(version: 0) {
      fields {
        fieldPath
      }
    }
  }
}
🙌 1
✅ 2
w
Thanks @big-carpet-38439 and @mammoth-bear-12532 Now my query works:
Copy code
{
  dataset(urn: "urn:li:dataset:(urn:li:dataPlatform:cg,kv_entity,PROD)") {
    schemaMetadata(version: 0) {
      fields {
        fieldPath
      }
    }
  }
}
Is it not possible to retrieve encapsulating object info? e.g. given a field, I want to find the list of DataSet which have field with that name?
b
You can use the ‘search’ GraphQL query to do this as of today!
I’ll try to find a sample
w
@big-carpet-38439, an example would be really helpful.