-
Notifications
You must be signed in to change notification settings - Fork 184
Is there a way to export gql response dynamicly? #301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
??? You need to know what you queried for to parse data for any query language, be it GraphQL, REST, SQL or anything else.
Then you may need to post-process your result. As a GraphQL result is returned in json format, you can use something like jsonpath
Same with REST |
Of course, but my expectations is that >>> res.TidKey
151
>>> res.TidValue
סכום בדיקת ROM שגוי
Thanks this might be what i am looking for, but still would be nice to have an API as stated above |
Other options:
|
You might be interested in this blog post explaining the flat chain syntax proposal even though it will probably never be added in the GraphQL spec as it was proposed 6 years ago... |
Thanks for the concern! @dataclass
class QueryType:
@dataclass
class Error:
message:str=""
code:str=""
query:str
receiver:qtc.Signal # (I'm using Qt for my GUI so the query is executed in another thread and result is emitted with a signal)
res: 'typing.Any' = None
flags:list= dataclasses.field(default_factory=list)
jpath:str="$"
success_jpath:str="$.*.success"
errors_jpath:str="$.*.errors.nonFieldErrors[*]"
count:int=0
errors:ErrorType=Error()
success:bool=False
"""number of times this query beed execudted in the server"""
def __repr__(self) -> str:
def P(obj):return pprint.pformat(obj,indent=3)
return f"""
query is->: {P(self.query)}\n
reciver is->: {self.receiver}\n
jpath is->: {self.jpath}\n
result is->: {P(self.res)}\n
flags are->: {P(self.flags)}\n
version is->: {P(self.count)}
etc...
""" Then i just create a constants class with all the override properties from the if ill have time in the future i intend to make a class that creates data-classes dynamically by the type of the return items |
The problem:
exporting data with
graphql
is inefficient .for example lets look at this query:
returns this json respons:
Lets assume i only need
TidKey
andTidValue
,to do this this is what you would normally find on the web:
Results this:

As you can see this is extremely inefficient for these reasons:
I hope i am missing something because otherwise its back to
REST
The text was updated successfully, but these errors were encountered: