Graphql Schema Mutations happen to use the default DB specified in settings.py. Since I have a Django project with multiple apps and db's , how can I specify graphql mutation to use a different db and not the default one.
class CreateCategory(graphene.Mutation):
class Arguments:
name = graphene.String(required=True)
slug = graphene.String(required=True)
category = graphene.Field(CategoryType)
@classmethod
def mutate(cls, root, info, name, slug):
category = Category()
category.name = name
category.slug = slug
print(category)
try:
category.save()
except:
traceback.print_exc()
return CreateCategory(category=category)