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

  • Print built query instead of executing it.

  • Contols:

    • Use / to fuzzy find field.

  • Variables:

    ╭─ Query
    │ v standard_library
    │   v package
    │     $ name*: name
    │     ■ id*: 5
    │     □ name
    │   □ number_of_downloads
    │ > statistics
    
    ╭─ Variables
    │ ■ name: "foo"
  • Arguments:

    Marked with *, or possibly color, or a combination.

    □: null
    ■: not null
    $: variable

    Scalar example:

    ╭─ Query
    │ v standard_library
    │   v package
    │     ■ name*: ""             # Cannot be unselected as it cannot be null.
    │     □ name
    │   > packages

    List example:

    ╭─ Query
    │ v item
    │   □ kinds*:                 # Argument is null.
    │   ■ kinds2*:                # List with two elements.
    │     [0] ■ a: "foo"
    │         ■ b: "eq"
    │         ■ c:
    │           v ■ a: "x"
    │             ■ b: "y"
    │           > ...
    │     [1] ■ a: "bar"
    │         ■ b: "ne"
    │         □ c:
    │     [2]

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

Uploaded Source

Built Distribution

gqt-0.24.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for gqt-0.24.0.tar.gz
Algorithm Hash digest
SHA256 1fa0b51e6442292945fdb84c547349410a3871240f2f9ecb0803306be5dabec6
MD5 c0ff815cad3c7163579f8d0c5f6d5a5a
BLAKE2b-256 4a5572109b2d4e5ab234ddd62e896ae2c6edfc2e8cd3a82f7ce7effe3d654eb3

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for gqt-0.24.0-py3-none-any.whl
Algorithm Hash digest
SHA256 be348b9e2cca2de2f0187e2379a177ed280934c9a54368422838667cc1bf5685
MD5 c3c9d9e477499ef3e7511ec3d9e8b453
BLAKE2b-256 e16fda3052a326afa9a03d00f87daf15ccc84dc44f638a2e86707a47d1aebcbe

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