Skip to main content

GraphQL query builder.

Project description

This project is inspired by https://graphiql-online.com.

https://github.com/eerimoq/gqt/raw/main/docs/assets/showcase.gif

Installation

$ pip3 install gqt

Usage

Set default GraphQL end-point URL:

$ export GQT_URL=https://mys-lang.org/graphql

Interactively create a query and execute it:

$ gqt
{
    "statistics": {
        "start_date_time": "2022-05-29 20:54:48",
        "number_of_graphql_requests": 234
    }
}

Repeat last query:

$ gqt -r
{
    "statistics": {
        "start_date_time": "2022-05-29 20:54:48",
        "number_of_graphql_requests": 234
    }
}

Print the query instead of executing it:

$ gqt -q
{"query":"{statistics {start_date_time number_of_graphql_requests}}"}

Use jq for colors (not seen below) and extracting field values:

$ gqt | jq
{
  "statistics": {
    "start_date_time": "2022-05-29 20:54:48",
    "number_of_graphql_requests": 235
  }
}
$ gqt | jq .statistics.number_of_graphql_requests
236

Ideas

  • Arguments and variables:

    □: null
    ■: not null
    $: variable

    Scalar example:

    ╭─ Query
    │ ▼ standard_library
    │   ▼ package
    │     ■ name: ""
    │     □ name
    │   ▶ packages

    List example:

    ╭─ Query
    │ ▼ item
    │   □ kinds:
    │   ■ kinds2:
    │     [0] ■ a: "foo"
    │         ■ b: "eq"
    │         ■ c:
    │           [0] ■ a: "x"
    │               ■ b: "y"
    │           [1]
    │     [1] ■ a: "bar"
    │         ■ b: "ne"
    │         □ c:
    │     [2]

    Variables example:

    ╭─ Query
    │ ▼ standard_library
    │   ▼ package
    │     $ name: name
    │     ■ id: 5
    │     $ kind: kind
    │     □ name
    │   □ number_of_downloads
    │ ▶ statistics
    
    ╭─ Variables
    │ name: "foo"
    │ kind:
    │   [0] ■ a: "bar"
    │       ■ b: "ne"
    │       □ c:
    │   [1]

    Print the variables:

    $ gqt -v
    {"name": "foo", "kind": [{"a": "bar", "b": "ne"}]}

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

gqt-0.27.0.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

gqt-0.27.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file gqt-0.27.0.tar.gz.

File metadata

  • Download URL: gqt-0.27.0.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for gqt-0.27.0.tar.gz
Algorithm Hash digest
SHA256 4ea10eca491548544a91fe64f3c091e7d9e489411b1309b3efc8272f5d2935f9
MD5 9a7df8814f94b4fa703cc332ce29bfa7
BLAKE2b-256 6b02af2cc4ab34047c3679984e20b9d23db288c3f1c0ab47f36b9cd716cfa371

See more details on using hashes here.

File details

Details for the file gqt-0.27.0-py3-none-any.whl.

File metadata

  • Download URL: gqt-0.27.0-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for gqt-0.27.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4189029c78f61d148a4889ccdac8d53e888d06d6714d2514a3c81e8b9e4859b5
MD5 17e96ee5b4fec3269844e02f53576cf0
BLAKE2b-256 eac9349f836fd3aa620a61cb1e085408efcca70b1c06369e0a7f3a27e827305c

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