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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for gqlmod-0.5.tar.gz
Algorithm Hash digest
SHA256 475b3ef89fb248600a7ea0cc1ce12c3f5f15daf8d3116812300b63212dc066ca
MD5 84e25930d6cfe1c6e785aa7cde1c3db0
BLAKE2b-256 72dc5a41c487336402ef739e8a7cd45f685d0303795ebba98133c303985b96f2

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for gqlmod-0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 28c654e1963a6d0d1bdb2e6dec37a24b13cfa22e9c5eb6809f5983c048361f67
MD5 1cad665d96c8a7d97c849534bbf29e9b
BLAKE2b-256 6b8480012eb75a2e80f75319df6dff9c7eb0124ed6bbac89fda7d4f32ce9c9db

See more details on using hashes here.

Supported by

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