Skip to main content

infrahubctl graphql

Various GraphQL related commands.

Usage:

$ infrahubctl graphql [OPTIONS] COMMAND [ARGS]...

Options:

  • --install-completion: Install completion for the current shell.
  • --show-completion: Show completion for the current shell, to copy it or customize the installation.
  • --help: Show this message and exit.

Commands:

  • query-report: Report how Infrahub will interpret a...
  • export-schema: Export the GraphQL schema to a file.
  • generate-return-types: Create Pydantic Models for GraphQL query...

infrahubctl graphql query-report​

Report how Infrahub will interpret a GraphQL query.

Reports whether the query targets unique nodes, meaning every query it contains returns a single object. Artifact and generator definitions use this to decide how much to regenerate when data changes: when it is true, only the artifacts or generator instances of the objects that changed are regenerated, and when it is false, all of them are.

A query returns a single object when it filters on ids or hfid, or on every part of one uniqueness constraint of the model, and the values it filters on are always provided.

Usage:

$ infrahubctl graphql query-report [OPTIONS] NAME

Arguments:

  • NAME: Name of the GraphQL query to analyze, as declared under queries in .infrahub.yml. [required]

Options:

  • --online: Fetch the query from the Infrahub server (CoreGraphQLQuery by name) instead of reading it from the local .infrahub.yml file.
  • --branch TEXT: Branch on which to run the report. Uniqueness constraints come from the schema, so the result can differ between branches.
  • --config-file TEXT: [env var: INFRAHUBCTL_CONFIG; default: infrahubctl.toml]
  • --help: Show this message and exit.

infrahubctl graphql export-schema​

Export the GraphQL schema to a file.

Usage:

$ infrahubctl graphql export-schema [OPTIONS]

Options:

  • --destination PATH: Path to the GraphQL schema file. [default: schema.graphql]
  • --config-file TEXT: [env var: INFRAHUBCTL_CONFIG; default: infrahubctl.toml]
  • --help: Show this message and exit.

infrahubctl graphql generate-return-types​

Create Pydantic Models for GraphQL query return types.

Usage:

$ infrahubctl graphql generate-return-types [OPTIONS] [QUERY]

Arguments:

  • [QUERY]: Location of the GraphQL query file(s). Defaults to current directory if not specified.

Options:

  • --schema PATH: Path to the GraphQL schema file. [default: schema.graphql]
  • --config-file TEXT: [env var: INFRAHUBCTL_CONFIG; default: infrahubctl.toml]
  • --help: Show this message and exit.