Tag: graphene-python
-
Graphene-python performance issues for large data sets
20 The bounty expires in 3 days. Answers to this question are eligible for a +100 reputation bounty. pdoherty926 is looking for a canonical answer. Currently using graphene-python with graphene-django (and graphene-django-optimizer). After receiving a GraphQL query, the database query is successfully completed in a fraction of a second; however, graphene doesn’t send a response…
-
Graphene-python performance issues for large data sets
20 The bounty expires in 3 days. Answers to this question are eligible for a +100 reputation bounty. pdoherty926 is looking for a canonical answer. Currently using graphene-python with graphene-django (and graphene-django-optimizer). After receiving a GraphQL query, the database query is successfully completed in a fraction of a second; however, graphene doesn’t send a response…
-
Need to create checkout session GraphQL + Django
0 I need to create a session for Stripe Checkout. According to Stripe Checkout Docs: Add an endpoint on your server that creates a Checkout Session. A Checkout Session controls what your customer sees in the Stripe-hosted payment page such as line items, the order amount and currency, and acceptable payment methods. Return the Checkout…
-
How to Log Exceptions in Graphene-Python
0 I currently have my logging configured as follows: LOGGING = { "version": 1, "disable_existing_loggers": False, "formatters": { "default": { "format": "{levelname} {asctime} {process} {module}: {message}", "style": "{", }, }, "handlers": { "console": { "level": "DEBUG", "class": "logging.StreamHandler", "formatter": "default", } }, "loggers": { "server": {"handlers": ["console"], "level": "DEBUG"}, "django": {"handlers": ["console"], "level": "INFO"}, "graphql.execution.utils":…
-
Best way to construct a GraphQL query string in Python
29 I’m trying to do this (see title), but it’s a bit complicated since the string I’m trying to build has to have the following properties: mulitiline contains curly braces I want to inject variables into it Using a normal ””” multiline string makes injecting variables difficult. Using multiple f-strings makes injecting variables easy, but…
-
Graphene – How to add the extensions map to a query resolver
0 According to the GraphQL spec, extensions should be supported in the response map. Reference https://spec.graphql.org/October2021/#sel-EAPHJCAACCoGu9J The response map may also contain an entry with key extensions. This entry, if set, must have a map as its value. This entry is reserved for implementors to extend the protocol however they see fit, and hence there…
-
Apollo-client returns “400 (Bad Request) Error” on sending mutation to server
13 I am currently using the vue-apollo package for Apollo client with VueJs stack with django and graphene-python for my GraphQl API. I have a simple setup with vue-apollo below: import Vue from ‘vue’ import { ApolloClient } from ‘apollo-client’ import { HttpLink } from ‘apollo-link-http’ import { InMemoryCache } from ‘apollo-cache-inmemory’ import VueApollo from…
-
Mutation for nested object
15 I’m trying to implement GraphQL mutation for a "complex" object. Let’s say we have a Contact with three fields: firstName, lastName and address, which is object with one field street: Here is my python scheme implementation: class Address(graphene.ObjectType): street = graphene.String(description=’Street Name’) class AddressInput(graphene.InputObjectType): street = graphene.String(description=’Street Name’, required=True) class Contact(graphene.ObjectType): first_name = graphene.String(description=’First…
-
Graphene Django – How to add extensions to the response object
0 It’s fairly common practice in GraphQL to return custom data on an extensions field (Facebook use this for image prefetch URLs for example). I am trying to do this in Graphene, and have made an attempt to do this in execute_graphql_request. class CustomGraphQLView(GraphQLView): def execute_graphql_request(self, request, *args, **kwargs): result = super().execute_graphql_request(request, *args, **kwargs) result.extensions[‘a’]…
-
‘function’ object has no attribute ‘__func__’ issue with graphene django
0 TypeError: UserProcessOptionsNode fields cannot be resolved. ‘function’ object has no attribute ‘__func__’ class UserProcessOptionsNode(DjangoObjectType): client_configuration = GenericScalar() class Meta: model = api_models.UserProcessOptions interfaces = (relay.Node,) filter_fields = ("user",) @classmethod def get_queryset(cls, queryset, info): user_list = [] user_list.append(info.context.user) user_list.append(info.context.user.parent_user) userprocess = queryset.filter(user__in=user_list) return userprocess This issue is caused when I upgrade graphene-django from 2.15.0 to…