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?
Release files for gqlmod 0.8.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gqlmod-0.8.2.tar.gz | 26.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gqlmod-0.8.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 46.1 kB
Release files / gqlmod-0.8.2.tar.gz
| Download URL | gqlmod-0.8.2.tar.gz |
|---|---|
| Size | 26.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e342dda314e095d3c9f4cca2db6ad923e17b6cf63e4fb0bbd6dd14e30fad9a0c
|
|
BLAKE2b-256 checksum How to use checksums |
ecf90c71c43a14c030c46611125eb2333b3832df3e50e11b001c9dcc6b5c2714
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / gqlmod-0.8.2-py3-none-any.whl
| Download URL | gqlmod-0.8.2-py3-none-any.whl |
|---|---|
| Size | 19.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
818e888259aa6587901ff2ccf161ff9f34b7e39937f51f7ffd3532d5eb5e456c
|
|
BLAKE2b-256 checksum How to use checksums |
c6c4e69de763afe122d7aaa30cc6c227b3a21268576a03415c50dcbec3fb6f13
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|