graphql-python/gql

DSL how to select fields which are Python reserved keywords

FrankC01 opened this issue · 2 comments

Here is the problem I face, I can create this using document node:

     """      nodes {
              name
              isEntry
              visibility
              return {
                signature
              }
    """

(lines omitted)

However I would like to create a DSL fragment but return fails Python (i.e. Outer.return.select(...)

Is there a way to inject a partial DocumentNode into a DocementNode generated from dsl_gql?

You could use either:

  • getattr(Outer, "return").select(...)
  • Outer.__getattr__("return").select(...)

Works like a charm, exactley what I needed.

Kudos!!!