Skip to main content

GraphQL Query Modules

Project description

Importable GraphQL modules

Documentation Status

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


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.4.tar.gz (22.0 kB view details)

Uploaded Source

Built Distribution

gqlmod-0.4-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file gqlmod-0.4.tar.gz.

File metadata

  • Download URL: gqlmod-0.4.tar.gz
  • Upload date:
  • Size: 22.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.4

File hashes

Hashes for gqlmod-0.4.tar.gz
Algorithm Hash digest
SHA256 f23f18dc990ced1cdaf5fd9575aa0b30fb3e2f818635110fc18b5359209c9412
MD5 dc5f3cc68e02748faab79da7ec14c42d
BLAKE2b-256 ad5a766113153157edafd95fdbf94a4173b24acbbc8028e6d42eaf5ed3c43fd3

See more details on using hashes here.

File details

Details for the file gqlmod-0.4-py3-none-any.whl.

File metadata

  • Download URL: gqlmod-0.4-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.4

File hashes

Hashes for gqlmod-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 28a48749a65c2665f665925d9c0644ed08a20680fc56462d9015f5464473a35b
MD5 4f25f89d927c6c77c5427e4944b07c2c
BLAKE2b-256 5f0c0c9e33fb17128599db250542aaca6ca1576bfe5edeaa7ce8a39c1ebe19cd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page