File: local_schema.rst

package info (click to toggle)
python-gql 3.6.0~b4-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,824 kB
  • sloc: python: 20,567; makefile: 52
file content (25 lines) | stat: -rw-r--r-- 612 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Execution on a local schema
===========================

It is also possible to execute queries against a local schema (so without a transport), even
if it is not really useful except maybe for testing.

.. code-block:: python

    from gql import gql, Client

    from .someSchema import SampleSchema

    client = Client(schema=SampleSchema)

    query = gql('''
        {
          hello
        }
    ''')

    result = client.execute(query)

See `tests/starwars/test_query.py`_ for an example

.. _tests/starwars/test_query.py: https://github.com/graphql-python/gql/blob/master/tests/starwars/test_query.py