Closed
Description
The problem:
exporting data with graphql
is inefficient .
for example lets look at this query:
query{
SiteById(id:852){
unitSet{
connableSet{
connablealertSet{
TidKey
TidValue
}
}
}
}
}
returns this json respons:
{
"SiteById": [
{
"unitSet": [
{
"connableSet": [
{
"connablealertSet": [
{ "TidKey": 151, "TidValue": "סכום בדיקת ROM שגוי" }
]
}
]
}
]
}
]
}
Lets assume i only need TidKey
and TidValue
,
to do this this is what you would normally find on the web:
import pandas as pd
pd.json_normalize(res['SiteById'][0]['unitSet'][0]['connableSet'][0]['connablealertSet'])
As you can see this is extremely inefficient for these reasons:
- I need to know exactly what i queried for.
- If the result had more fields the code above would break .
- If i would change the query slightly i would need to change how i export it as well.
I hope i am missing something because otherwise its back to REST