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
|