user-2
March 4, 2024, 4:48pm
1
Original Slack Thread
Hello All /<@U02G4B6ADL6>,
I am trying to get all the glossary items ingested in datahub,
and i am using follwing code, i get 200 but no data, can anyone please help?
import http.client
conn = http.client.HTTPConnection(“localhost:8080”)
payload = “{ "query": "{dataset(urn: \"urn:li:dataset:(urn:li:dataPlatform:hive,fct_users_created,PROD)\") {glossaryTerms {terms {term {urn glossaryTermInfo { name description } } } } } }", "variables":{}}”
headers = {
‘Authorization’: “Bearer <my-access-token>”,
‘Content-Type’: “application/json”
}
conn.request(“POST”, “/api/graphql”, payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode(“utf-8”))
user-1
March 4, 2024, 4:49pm
2
Try below query:
graphQl = """
query getGlossaryTerms {
searchAcrossEntities (input:{
types:[GLOSSARY_TERM],
query:"*",
start:0
count:1000
}) {
searchResults{
entity{
urn
}
}
}
}
"""```
user-2
March 4, 2024, 4:49pm
3
Thanks Walt, i was able to get the result using the query above, however i am looking to get the name and description of glossary item and i am getting
user-2
March 4, 2024, 4:49pm
4
“searchResults”: [
{
“entity”: {
“urn”: “urn:li:glossaryTerm:00601529b797fa6a905ca1bcd5be53dd”
}
},
{
“entity”: {
“urn”: “urn:li:glossaryTerm:00c0b6b1e4560fa7851f976630418201”
}
},
{
“entity”: {
“urn”: “urn:li:glossaryTerm:0111319484eb3fd5a3b53317712d41ea”
}
},
{
“entity”: {
“urn”: “urn:li:glossaryTerm:016b8554353b868cbc818a502a477422”
}
},
{
“entity”: {
“urn”: “urn:li:glossaryTerm:01a8c298bc2eb31fdf4089d20b449505”
}
},
{
“entity”: {
“urn”: “urn:li:glossaryTerm:01cefd5f50d1b8f387766741ad301b36”
}
},
{
“entity”: {
“urn”: “urn:li:glossaryTerm:02735c9f8d0e7deb1d1d13266059b478”
}
},
{
“entity”: {
“urn”: “urn:li:glossaryTerm:0290a420455f40144010b136754f631f”
}
},
{
“entity”: {
“urn”: “urn:li:glossaryTerm:036174d8bc7abebf13cb9a7c1a5e9f77”
}
},
{
“entity”: {
“urn”: “urn:li:glossaryTerm:0375f3d6d31331627f5ab7440800fc07”
}
}
user-2
March 4, 2024, 4:49pm
5
Thanks Walt, i was able to get the result using the query above, however i am looking to get the name and description of glossary item and i am getting,
whatever i try i am getting
“searchResults”: [
{
“entity”: {
“urn”: “urn:li:glossaryTerm:00601529b797fa6a905ca1bcd5be53dd”
}
}
i modified the query to the following but i am getting error “Validation error (MissingFieldArgument@[dataset]) : Missing field argument ‘urn’”,
query getGlossaryTerms {
searchAcrossEntities(
input: {types: [GLOSSARY_TERM], query: “*”, start: 0, count: 1000}
) {
searchResults {
entity {
urn
}
}
}
dataset {
properties {
name
description
}
}
}
user-1
March 4, 2024, 4:49pm
6
query getGlossaryTerms {
searchAcrossEntities (input:{
types:[GLOSSARY_TERM],
query:"*",
start:0
count:1000
}) {
searchResults{
entity{
urn
...on GlossaryTerm {
properties{
name,
description
}
}
}
}
}
}