GraphQL Query Modules
Project description
Importable GraphQL modules
gqlmod
allows you to keep your GraphQL queries in .gql
files and import them
as modules.
- Validation of queries at import time
- Validation of queries against the schema
Usage
Install both gqlmod
and any providers you need. (The starwars
provider ships
with gqlmod
, so you can begin playing with it immediately.)
Define a .gql
file with your queries and mutations, like so:
#~starwars~
query HeroForEpisode($ep: Episode!) {
hero(episode: $ep) {
name
... on Droid {
primaryFunction
}
... on Human {
homePlanet
}
}
}
And then you can just import it and use it:
import gqlmod # noqa
from mygql import HeroForEpisode
print(HeroForEpisode(ep='JEDI'))
Why
So why use this?
- Strong validation as soon as possible (when the modules are imported)
- All the work is done at warmup, not when the query is made
- I think not mixing languages produces cleaner code?
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
gqlmod-0.8.2.tar.gz
(26.5 kB
view details)
Built Distribution
gqlmod-0.8.2-py3-none-any.whl
(19.5 kB
view details)
File details
Details for the file gqlmod-0.8.2.tar.gz
.
File metadata
- Download URL: gqlmod-0.8.2.tar.gz
- Upload date:
- Size: 26.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e342dda314e095d3c9f4cca2db6ad923e17b6cf63e4fb0bbd6dd14e30fad9a0c |
|
MD5 | 67a7eb6e398c8f2537dfea3b096649c2 |
|
BLAKE2b-256 | ecf90c71c43a14c030c46611125eb2333b3832df3e50e11b001c9dcc6b5c2714 |
File details
Details for the file gqlmod-0.8.2-py3-none-any.whl
.
File metadata
- Download URL: gqlmod-0.8.2-py3-none-any.whl
- Upload date:
- Size: 19.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 818e888259aa6587901ff2ccf161ff9f34b7e39937f51f7ffd3532d5eb5e456c |
|
MD5 | edca5c912443be8d08e65f118523492a |
|
BLAKE2b-256 | c6c4e69de763afe122d7aaa30cc6c227b3a21268576a03415c50dcbec3fb6f13 |