easy-graphql-server


Nameeasy-graphql-server JSON
Version 0.9.31 PyPI version JSON
download
home_pagehttps://github.com/mathieurodic/easy-graphql-server
SummaryEasy to use abstraction layer for GraphQL, with support for Django ORM.
upload_time2023-01-24 14:01:54
maintainer
docs_urlNone
authorMathieu Rodic
requires_python>=3.6,<4
licenseMIT license
keywords graphql django
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Easy GraphQL Server

**easy_graphql_server** provides an easy way to expose a database in GraphQL, using ORM models and web frameworks (so far only Django is supported, but SQLAlchemy & Flask will soon come).

<!-- TOC depthFrom:1 depthTo:6 withLinks:1 updateOnSave:1 orderedList:0 -->

- [Easy GraphQL Server](#easy-graphql-server)
	- [Usage](#usage)
		- [Expose methods](#expose-methods)
			- [Calling `Schema.expose_query()` and `Schema.expose_mutation()`](#calling-schemaexposequery-and-schemaexposemutation)
			- [Subclassing `Schema.ExposedQuery` and `Schema.ExposedMutation`](#subclassing-schemaexposedquery-and-schemaexposedmutation)
			- [Subclassing `easy_graphql_server.ExposedQuery` and `easy_graphql_server.ExposedMutation`](#subclassing-easygraphqlserverexposedquery-and-easygraphqlserverexposedmutation)
			- [Available options for exposing methods](#available-options-for-exposing-methods)
		- [Expose ORM models](#expose-orm-models)
			- [Calling `Schema.expose_model()`](#calling-schemaexposemodel)
			- [Subclassing `Schema.ExposedModel`](#subclassing-schemaexposedmodel)
			- [Subclassing `easy_graphql_server.ExposedModel`](#subclassing-easygraphqlserverexposedmodel)
			- [Available options for exposing models](#available-options-for-exposing-models)
		- [Perform GraphQL queries](#perform-graphql-queries)
	- [Credits and history](#credits-and-history)
	- [License](#license)

<!-- /TOC -->

**easy_graphql_server** can be installed from PyPI using the built-in pip command:

```bash
pip install easy-graphql-server
```

## Usage

### Expose methods

There are three ways to expose a method in the GraphQL schema.

#### Calling `Schema.expose_query()` and `Schema.expose_mutation()`

```python
import easy_graphql_server as egs

schema = egs.Schema()

schema.expose_query(
    name = 'foo',
    input_format = {
        'input_string': egs.Required(str),
        'input_integer': int,
    },
    output_format = {
        'output_string': str,
        'output_integer': int,
    },
    method = lambda input_string, input_integer=None: {
        'output_string': 2 * input_string,
        'output_integer': None if input_integer is None else 2 * input_integer,
    },
)

_internal_value = 0
def bar_mutation_method(value=None, increment_value=None):
    if value is not None:
        _internal_value = value
    if increment_value is not None:
        _internal_value += increment_value
    return {
        'value': _internal_value,
    }

schema.expose_mutation(
    name = 'bar',
    input_format = {
        'input_string': egs.Required(str),
        'input_integer': int,
    },
    output_format = {
        'output_string': str,
        'output_integer': int,
    },
    method = bar_mutation_method,
)
```

#### Subclassing `Schema.ExposedQuery` and `Schema.ExposedMutation`

```python
import easy_graphql_server as egs

schema = egs.Schema()

class FooQuery(schema.ExposedQuery):
    name = 'foo'
    input_format = {
        'input_string': egs.Required(str),
        'input_integer': int,
    }
    output_format = {
        'output_string': str,
        'output_integer': int,
    }
    @staticmethod
    def method(input_string, input_integer=None):
        return {
            'output_string': 2 * input_string,
            'output_integer': None if input_integer is None else 2 * input_integer,
        }

class BarMutation(schema.ExposedMutation):
    name = 'bar'
    _internal_value = 0
    input_format = {
        'value': int,
        'increment_value': int,
    }
    output_format = {
        'value': int,
    }
    @classmethod
    def method(cls, value=None, increment_value=None):
        if value is not None:
            cls._internal_value = value
        if increment_value is not None:
            cls._internal_value += increment_value
        return {
            'value': cls._internal_value,
        }
```

#### Subclassing `easy_graphql_server.ExposedQuery` and `easy_graphql_server.ExposedMutation`

This is very similar to the previous way.

```python
import easy_graphql_server as egs

class FooQuery(schema.ExposedQuery):
    name = 'foo'
    input_format = {
        'input_string': egs.Required(str),
        'input_integer': int,
    }
    output_format = {
        'output_string': str,
        'output_integer': int,
    }
    @staticmethod
    def method(input_string, input_integer=None):
        return {
            'output_string': 2 * input_string,
            'output_integer': None if input_integer is None else 2 * input_integer,
        }

class BarMutation(schema.ExposedMutation):
    name = 'bar'
    _internal_value = 0
    input_format = {
        'value': int,
        'increment_value': int,
    }
    output_format = {
        'value': int,
    }
    @classmethod
    def method(cls, value=None, increment_value=None):
        if value is not None:
            cls._internal_value = value
        if increment_value is not None:
            cls._internal_value += increment_value
        return {
            'value': cls._internal_value,
        }

schema = egs.Schema()
schema.expose(FooQuery)
schema.expose(BarMutation)
```

#### Available options for exposing methods

The same options can be passed either as class attributes for subclasses of `Schema.ExposedQuery` and `Schema.ExposedMutation`, or as keyword arguments to `Schema.expose_query()` and `Schema.expose_mutation()` methods.

Options for *queries* and *mutations* are the same.

 * `name` is the name under which the method shall be exposed

 * `method` is the callback function of your choice

 * `input_format` is the input format for the GraphQL method, passed as a (possibly recursive) mapping; if unspecified or `None`, the defined GraphQL method will take no input; the mapping keys are

 * `output_format` is the output format of the GraphQL method, passed as a (possibly recursive) mapping or as a `list` containing one mapping

 * `pass_graphql_selection` can either be a `bool` or a `str`; if set to `True`, the `graphql_selection` parameter will be passed to the callback method, indicating which fields are requested for output; if set to a `str`, the given string will be the name of the keyword parameter passed to the callback method instead of `graphql_selection`

 * `pass_graphql_path` can either be a `bool` or a `str`; if set to `True`, the `graphql_path` parameter will be passed to the callback method, indicating as a `list[str]` the GraphQL path in which the method is being executed; if set to a `str`, the given string will be the name of the keyword parameter passed to the callback method instead of `graphql_path`

 * `pass_authenticated_user` can either be a `bool` or a `str`; if set to `True`, the `authenticated_user` parameter will be passed to the callback method, indicating the user authenticated in the source HTTP request (or `None` if the request was unauthenticated); if set to a `str`, the given string will be the name of the keyword parameter passed to the callback method instead of `authenticated_user`

 * `require_authenticated_user` is a `bool` indicating whether or not authentication is required for the exposed method

### Expose ORM models

What does it do?

For instance, exposing a model called `Thing` will expose the following queries...

 * `thing`: fetch a single instance of the model given its unique identifier
 * `things`: fetch a collection of model instances, given filtering criteria, or unfiltered, paginated or not

...and mutations:

 * `create_thing`: create a single instance of the model given the data to be inserted
 * `update_thing`: update a single instance of the model given its unique identifier and a mapping the new data to apply
 * `delete_thing`: delete a single instance of the model given its unique identifier


#### Calling `Schema.expose_model()`

```python
import easy_graphql_server
from my_django_application.models import Person

schema = easy_graphql_server.Schema()

schema.expose_model(
	orm_model=Person,
	plural_name='people',
	can_expose=('id', 'first_name', 'last_name'),
	cannot_write=('id',),
)
```

#### Subclassing `Schema.ExposedModel`

```python
import easy_graphql_server
from my_django_application.models import Person

schema = easy_graphql_server.Schema()

class ExposedPerson(schema.ExposedModel):
		orm_model = Person
		plural_name = 'people'
		can_expose = ('id', 'first_name', 'last_name')
		cannot_write = ('id',)
```

#### Subclassing `easy_graphql_server.ExposedModel`

This is very similar to the previous way.

```python
import easy_graphql_server
from my_django_application.models import Person

schema = easy_graphql_server.Schema()

class ExposedPerson(easy_graphql_server.ExposedModel):
		orm_model = Person
		plural_name = 'people'
		can_expose = ('id', 'first_name', 'last_name')
		cannot_write = ('id',)

schema = easy_graphql_server.Schema()
schema.expose(ExposedPerson)
```

#### Available options for exposing models

The same options can be passed either as class attributes for subclasses of `ExposedModel`, or as keyword arguments to `Schema.expose_model()` method.

* `cannot_expose` is either a `bool`, or a `tuple[str]`; defaults to `False`; if set to `True`, no query or mutation method will be exposed for the model; if set to a list of field names, those fields will be excluded from every query and mutation

* `can_create` is either a `bool`, or a `tuple[str]`; defaults to `True`; if set to `False`, no creation mutation method will be exposed for the model; if set to a list of field names, only those fields will be possible field values passed at insertion time to `create_...`

* `cannot_create` is either a `bool`, or a `tuple[str]`; defaults to `False`; if set to `True`, no creation mutation method will be exposed for the model; if set to a list of field names, those fields will be excluded from possible field values passed at insertion time to `create_...`

* `can_read` is either a `bool`, or a `tuple[str]`; defaults to `True`; if set to `False`, no query method will be exposed for the model; if set to a list of field names, only those fields will be exposed for the `...` (show one instance) and `...s` (show a collection of instances) queries (it also defines which fields are available as mutations results)

* `cannot_read` is either a `bool`, or a `tuple[str]`; defaults to `False`; if set to `True`, no query method will be exposed for the model; if set to a list of field names, only those fields will be exposed for the `...` (show one instance) and `...s` (show a collection of instances) queries (it also defines which fields are not available as mutations results)

* `can_update` is either a `bool`, or a `tuple[str]`; defaults to `True`; if set to `True`, no `delete_...` mutation method will be exposed for the model; if set to a list of field names, those fields will be the only possible keys for the `_` parameter (new data for instance fields) of the `update_...` mutation

* `cannot_update` is either a `bool`, or a `tuple[str]`; defaults to `False`; if set to `True`, no `update_...` mutation method will be exposed for the model; if set to a list of field names, those fields will be excluded from possible keys for the `_` parameter (new data for instance fields) of the `update_...` mutation

* `can_delete` is a `bool`; defaults to `True`; if set to `False`, no `delete_...` mutation method will be exposed for the model

* `cannot_delete` is a `bool`; defaults to `False`; if set to `True`, no `delete_...` mutation method will be exposed for the model

* `only_when_child_of` is either `None` (model does not have to be nested to be exposed), `True` (the model is not exposed if not nested), an ORM model class, or a tuple/list/set of ORM model classes (the defined model can only be exposed when nested directly under one of models passed as `only_when_child_of` parameter)

* `require_authenticated_user` is a `bool` indicating whether or not authentication is required for the exposed method

* `has_permission` is either `None`, or a callback method returning a `bool` (`True` if operation is authorized, `False` otherwise), and taking as parameters `authenticated_user` (self-explanatory), `operation` (a value of the `easy_graphql_server.Operation` enum: `CREATE`, `READ`, `UPDATE` or `DELETE`) and `data` (new data, only applies to `CREATE` and `UPDATE`)

* `filter_for_user` is either `None`, or a callback method returning a `queryset`, and taking as parameters `queryset` and `authenticated_user`

### Perform GraphQL queries

If you want to perform GraphQL queries on the schema without going through a schema, you can use `Schema.execute()`. This method can take the following parameters:

 * `query`: the GraphQL query, in the form of a `str`
 * `variables`: variables to go along with the query (optional), as a `dict[str,Any]`
 * `operation_name`: name of the operation to be executed within the query (optional)
 * `authenticated_user`: parameter that will be passed to the callback functions of GraphQL methods that require it (optional)
 * `serializable_output`: the output will be rendered as JSON-serializable `dict`, instead of a `graphql.execution.execute.ExecutionResult` instance

## Credits and history

The **easy_graphql_server** library was originally a subproject within the [Bridger](https://www.rightsbridger.com/) development
team, to provide an easy way to expose database models with GraphQL using
[Graphene](https://github.com/graphql-python/graphene).

The project was then rewritten with [graphq-core](https://github.com/graphql-python/graphql-core/)
and Graphene was dropped.

## License

**easy_graphql_server** is under MIT license.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mathieurodic/easy-graphql-server",
    "name": "easy-graphql-server",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6,<4",
    "maintainer_email": "",
    "keywords": "graphql django",
    "author": "Mathieu Rodic",
    "author_email": "graphql@rodic.fr",
    "download_url": "https://files.pythonhosted.org/packages/77/e5/d50d9c25c77d2b3368f5c35c8dcff0e0905e70166bacbab21c0ccc97d6db/easy_graphql_server-0.9.31.tar.gz",
    "platform": null,
    "description": "# Easy GraphQL Server\n\n**easy_graphql_server** provides an easy way to expose a database in GraphQL, using ORM models and web frameworks (so far only Django is supported, but SQLAlchemy & Flask will soon come).\n\n<!-- TOC depthFrom:1 depthTo:6 withLinks:1 updateOnSave:1 orderedList:0 -->\n\n- [Easy GraphQL Server](#easy-graphql-server)\n\t- [Usage](#usage)\n\t\t- [Expose methods](#expose-methods)\n\t\t\t- [Calling `Schema.expose_query()` and `Schema.expose_mutation()`](#calling-schemaexposequery-and-schemaexposemutation)\n\t\t\t- [Subclassing `Schema.ExposedQuery` and `Schema.ExposedMutation`](#subclassing-schemaexposedquery-and-schemaexposedmutation)\n\t\t\t- [Subclassing `easy_graphql_server.ExposedQuery` and `easy_graphql_server.ExposedMutation`](#subclassing-easygraphqlserverexposedquery-and-easygraphqlserverexposedmutation)\n\t\t\t- [Available options for exposing methods](#available-options-for-exposing-methods)\n\t\t- [Expose ORM models](#expose-orm-models)\n\t\t\t- [Calling `Schema.expose_model()`](#calling-schemaexposemodel)\n\t\t\t- [Subclassing `Schema.ExposedModel`](#subclassing-schemaexposedmodel)\n\t\t\t- [Subclassing `easy_graphql_server.ExposedModel`](#subclassing-easygraphqlserverexposedmodel)\n\t\t\t- [Available options for exposing models](#available-options-for-exposing-models)\n\t\t- [Perform GraphQL queries](#perform-graphql-queries)\n\t- [Credits and history](#credits-and-history)\n\t- [License](#license)\n\n<!-- /TOC -->\n\n**easy_graphql_server** can be installed from PyPI using the built-in pip command:\n\n```bash\npip install easy-graphql-server\n```\n\n## Usage\n\n### Expose methods\n\nThere are three ways to expose a method in the GraphQL schema.\n\n#### Calling `Schema.expose_query()` and `Schema.expose_mutation()`\n\n```python\nimport easy_graphql_server as egs\n\nschema = egs.Schema()\n\nschema.expose_query(\n    name = 'foo',\n    input_format = {\n        'input_string': egs.Required(str),\n        'input_integer': int,\n    },\n    output_format = {\n        'output_string': str,\n        'output_integer': int,\n    },\n    method = lambda input_string, input_integer=None: {\n        'output_string': 2 * input_string,\n        'output_integer': None if input_integer is None else 2 * input_integer,\n    },\n)\n\n_internal_value = 0\ndef bar_mutation_method(value=None, increment_value=None):\n    if value is not None:\n        _internal_value = value\n    if increment_value is not None:\n        _internal_value += increment_value\n    return {\n        'value': _internal_value,\n    }\n\nschema.expose_mutation(\n    name = 'bar',\n    input_format = {\n        'input_string': egs.Required(str),\n        'input_integer': int,\n    },\n    output_format = {\n        'output_string': str,\n        'output_integer': int,\n    },\n    method = bar_mutation_method,\n)\n```\n\n#### Subclassing `Schema.ExposedQuery` and `Schema.ExposedMutation`\n\n```python\nimport easy_graphql_server as egs\n\nschema = egs.Schema()\n\nclass FooQuery(schema.ExposedQuery):\n    name = 'foo'\n    input_format = {\n        'input_string': egs.Required(str),\n        'input_integer': int,\n    }\n    output_format = {\n        'output_string': str,\n        'output_integer': int,\n    }\n    @staticmethod\n    def method(input_string, input_integer=None):\n        return {\n            'output_string': 2 * input_string,\n            'output_integer': None if input_integer is None else 2 * input_integer,\n        }\n\nclass BarMutation(schema.ExposedMutation):\n    name = 'bar'\n    _internal_value = 0\n    input_format = {\n        'value': int,\n        'increment_value': int,\n    }\n    output_format = {\n        'value': int,\n    }\n    @classmethod\n    def method(cls, value=None, increment_value=None):\n        if value is not None:\n            cls._internal_value = value\n        if increment_value is not None:\n            cls._internal_value += increment_value\n        return {\n            'value': cls._internal_value,\n        }\n```\n\n#### Subclassing `easy_graphql_server.ExposedQuery` and `easy_graphql_server.ExposedMutation`\n\nThis is very similar to the previous way.\n\n```python\nimport easy_graphql_server as egs\n\nclass FooQuery(schema.ExposedQuery):\n    name = 'foo'\n    input_format = {\n        'input_string': egs.Required(str),\n        'input_integer': int,\n    }\n    output_format = {\n        'output_string': str,\n        'output_integer': int,\n    }\n    @staticmethod\n    def method(input_string, input_integer=None):\n        return {\n            'output_string': 2 * input_string,\n            'output_integer': None if input_integer is None else 2 * input_integer,\n        }\n\nclass BarMutation(schema.ExposedMutation):\n    name = 'bar'\n    _internal_value = 0\n    input_format = {\n        'value': int,\n        'increment_value': int,\n    }\n    output_format = {\n        'value': int,\n    }\n    @classmethod\n    def method(cls, value=None, increment_value=None):\n        if value is not None:\n            cls._internal_value = value\n        if increment_value is not None:\n            cls._internal_value += increment_value\n        return {\n            'value': cls._internal_value,\n        }\n\nschema = egs.Schema()\nschema.expose(FooQuery)\nschema.expose(BarMutation)\n```\n\n#### Available options for exposing methods\n\nThe same options can be passed either as class attributes for subclasses of `Schema.ExposedQuery` and `Schema.ExposedMutation`, or as keyword arguments to `Schema.expose_query()` and `Schema.expose_mutation()` methods.\n\nOptions for *queries* and *mutations* are the same.\n\n * `name` is the name under which the method shall be exposed\n\n * `method` is the callback function of your choice\n\n * `input_format` is the input format for the GraphQL method, passed as a (possibly recursive) mapping; if unspecified or `None`, the defined GraphQL method will take no input; the mapping keys are\n\n * `output_format` is the output format of the GraphQL method, passed as a (possibly recursive) mapping or as a `list` containing one mapping\n\n * `pass_graphql_selection` can either be a `bool` or a `str`; if set to `True`, the `graphql_selection` parameter will be passed to the callback method, indicating which fields are requested for output; if set to a `str`, the given string will be the name of the keyword parameter passed to the callback method instead of `graphql_selection`\n\n * `pass_graphql_path` can either be a `bool` or a `str`; if set to `True`, the `graphql_path` parameter will be passed to the callback method, indicating as a `list[str]` the GraphQL path in which the method is being executed; if set to a `str`, the given string will be the name of the keyword parameter passed to the callback method instead of `graphql_path`\n\n * `pass_authenticated_user` can either be a `bool` or a `str`; if set to `True`, the `authenticated_user` parameter will be passed to the callback method, indicating the user authenticated in the source HTTP request (or `None` if the request was unauthenticated); if set to a `str`, the given string will be the name of the keyword parameter passed to the callback method instead of `authenticated_user`\n\n * `require_authenticated_user` is a `bool` indicating whether or not authentication is required for the exposed method\n\n### Expose ORM models\n\nWhat does it do?\n\nFor instance, exposing a model called `Thing` will expose the following queries...\n\n * `thing`: fetch a single instance of the model given its unique identifier\n * `things`: fetch a collection of model instances, given filtering criteria, or unfiltered, paginated or not\n\n...and mutations:\n\n * `create_thing`: create a single instance of the model given the data to be inserted\n * `update_thing`: update a single instance of the model given its unique identifier and a mapping the new data to apply\n * `delete_thing`: delete a single instance of the model given its unique identifier\n\n\n#### Calling `Schema.expose_model()`\n\n```python\nimport easy_graphql_server\nfrom my_django_application.models import Person\n\nschema = easy_graphql_server.Schema()\n\nschema.expose_model(\n\torm_model=Person,\n\tplural_name='people',\n\tcan_expose=('id', 'first_name', 'last_name'),\n\tcannot_write=('id',),\n)\n```\n\n#### Subclassing `Schema.ExposedModel`\n\n```python\nimport easy_graphql_server\nfrom my_django_application.models import Person\n\nschema = easy_graphql_server.Schema()\n\nclass ExposedPerson(schema.ExposedModel):\n\t\torm_model = Person\n\t\tplural_name = 'people'\n\t\tcan_expose = ('id', 'first_name', 'last_name')\n\t\tcannot_write = ('id',)\n```\n\n#### Subclassing `easy_graphql_server.ExposedModel`\n\nThis is very similar to the previous way.\n\n```python\nimport easy_graphql_server\nfrom my_django_application.models import Person\n\nschema = easy_graphql_server.Schema()\n\nclass ExposedPerson(easy_graphql_server.ExposedModel):\n\t\torm_model = Person\n\t\tplural_name = 'people'\n\t\tcan_expose = ('id', 'first_name', 'last_name')\n\t\tcannot_write = ('id',)\n\nschema = easy_graphql_server.Schema()\nschema.expose(ExposedPerson)\n```\n\n#### Available options for exposing models\n\nThe same options can be passed either as class attributes for subclasses of `ExposedModel`, or as keyword arguments to `Schema.expose_model()` method.\n\n* `cannot_expose` is either a `bool`, or a `tuple[str]`; defaults to `False`; if set to `True`, no query or mutation method will be exposed for the model; if set to a list of field names, those fields will be excluded from every query and mutation\n\n* `can_create` is either a `bool`, or a `tuple[str]`; defaults to `True`; if set to `False`, no creation mutation method will be exposed for the model; if set to a list of field names, only those fields will be possible field values passed at insertion time to `create_...`\n\n* `cannot_create` is either a `bool`, or a `tuple[str]`; defaults to `False`; if set to `True`, no creation mutation method will be exposed for the model; if set to a list of field names, those fields will be excluded from possible field values passed at insertion time to `create_...`\n\n* `can_read` is either a `bool`, or a `tuple[str]`; defaults to `True`; if set to `False`, no query method will be exposed for the model; if set to a list of field names, only those fields will be exposed for the `...` (show one instance) and `...s` (show a collection of instances) queries (it also defines which fields are available as mutations results)\n\n* `cannot_read` is either a `bool`, or a `tuple[str]`; defaults to `False`; if set to `True`, no query method will be exposed for the model; if set to a list of field names, only those fields will be exposed for the `...` (show one instance) and `...s` (show a collection of instances) queries (it also defines which fields are not available as mutations results)\n\n* `can_update` is either a `bool`, or a `tuple[str]`; defaults to `True`; if set to `True`, no `delete_...` mutation method will be exposed for the model; if set to a list of field names, those fields will be the only possible keys for the `_` parameter (new data for instance fields) of the `update_...` mutation\n\n* `cannot_update` is either a `bool`, or a `tuple[str]`; defaults to `False`; if set to `True`, no `update_...` mutation method will be exposed for the model; if set to a list of field names, those fields will be excluded from possible keys for the `_` parameter (new data for instance fields) of the `update_...` mutation\n\n* `can_delete` is a `bool`; defaults to `True`; if set to `False`, no `delete_...` mutation method will be exposed for the model\n\n* `cannot_delete` is a `bool`; defaults to `False`; if set to `True`, no `delete_...` mutation method will be exposed for the model\n\n* `only_when_child_of` is either `None` (model does not have to be nested to be exposed), `True` (the model is not exposed if not nested), an ORM model class, or a tuple/list/set of ORM model classes (the defined model can only be exposed when nested directly under one of models passed as `only_when_child_of` parameter)\n\n* `require_authenticated_user` is a `bool` indicating whether or not authentication is required for the exposed method\n\n* `has_permission` is either `None`, or a callback method returning a `bool` (`True` if operation is authorized, `False` otherwise), and taking as parameters `authenticated_user` (self-explanatory), `operation` (a value of the `easy_graphql_server.Operation` enum: `CREATE`, `READ`, `UPDATE` or `DELETE`) and `data` (new data, only applies to `CREATE` and `UPDATE`)\n\n* `filter_for_user` is either `None`, or a callback method returning a `queryset`, and taking as parameters `queryset` and `authenticated_user`\n\n### Perform GraphQL queries\n\nIf you want to perform GraphQL queries on the schema without going through a schema, you can use `Schema.execute()`. This method can take the following parameters:\n\n * `query`: the GraphQL query, in the form of a `str`\n * `variables`: variables to go along with the query (optional), as a `dict[str,Any]`\n * `operation_name`: name of the operation to be executed within the query (optional)\n * `authenticated_user`: parameter that will be passed to the callback functions of GraphQL methods that require it (optional)\n * `serializable_output`: the output will be rendered as JSON-serializable `dict`, instead of a `graphql.execution.execute.ExecutionResult` instance\n\n## Credits and history\n\nThe **easy_graphql_server** library was originally a subproject within the [Bridger](https://www.rightsbridger.com/) development\nteam, to provide an easy way to expose database models with GraphQL using\n[Graphene](https://github.com/graphql-python/graphene).\n\nThe project was then rewritten with [graphq-core](https://github.com/graphql-python/graphql-core/)\nand Graphene was dropped.\n\n## License\n\n**easy_graphql_server** is under MIT license.\n",
    "bugtrack_url": null,
    "license": "MIT license",
    "summary": "Easy to use abstraction layer for GraphQL, with support for Django ORM.",
    "version": "0.9.31",
    "split_keywords": [
        "graphql",
        "django"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "42252b79d4f56748505c4397b6756c2404d9c961065848c083684eb90701cb4d",
                "md5": "fad3951cebe0eda9b4375aebde6ac86b",
                "sha256": "d3b72f66cdd30d6204e25d601f89b6ad0df061e04623aacd5259517a0cbd13d8"
            },
            "downloads": -1,
            "filename": "easy_graphql_server-0.9.31-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fad3951cebe0eda9b4375aebde6ac86b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6,<4",
            "size": 46363,
            "upload_time": "2023-01-24T14:01:51",
            "upload_time_iso_8601": "2023-01-24T14:01:51.065126Z",
            "url": "https://files.pythonhosted.org/packages/42/25/2b79d4f56748505c4397b6756c2404d9c961065848c083684eb90701cb4d/easy_graphql_server-0.9.31-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "77e5d50d9c25c77d2b3368f5c35c8dcff0e0905e70166bacbab21c0ccc97d6db",
                "md5": "62387fad534f3f44b6e588e2db6d905b",
                "sha256": "da6302487e6ac1d5a094c361eb9c31de5bee7a0f21f883494501828d37fc61ac"
            },
            "downloads": -1,
            "filename": "easy_graphql_server-0.9.31.tar.gz",
            "has_sig": false,
            "md5_digest": "62387fad534f3f44b6e588e2db6d905b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6,<4",
            "size": 40981,
            "upload_time": "2023-01-24T14:01:54",
            "upload_time_iso_8601": "2023-01-24T14:01:54.860025Z",
            "url": "https://files.pythonhosted.org/packages/77/e5/d50d9c25c77d2b3368f5c35c8dcff0e0905e70166bacbab21c0ccc97d6db/easy_graphql_server-0.9.31.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-24 14:01:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "mathieurodic",
    "github_project": "easy-graphql-server",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "easy-graphql-server"
}
        
Elapsed time: 0.03381s