From c9f4d73022e2224ecb782e5adc21b7a33849f23f Mon Sep 17 00:00:00 2001 From: Hanusz Leszek Date: Sat, 9 Apr 2022 21:56:45 +0200 Subject: [PATCH] DOC DSL add note for arguments with Python keywords --- docs/advanced/dsl_module.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/advanced/dsl_module.rst b/docs/advanced/dsl_module.rst index f4046f27..fd485274 100644 --- a/docs/advanced/dsl_module.rst +++ b/docs/advanced/dsl_module.rst @@ -125,6 +125,12 @@ It can also be done using the :meth:`args ` method:: ds.Query.human.args(id="1000").select(ds.Human.name) +.. note:: + If your argument name is a Python keyword (for, in, from, ...), you will receive a + SyntaxError (See `issue #308`_). To fix this, you can provide the arguments by unpacking a dictionary. + + For example, instead of using :code:`from=5`, you can use :code:`**{"from":5}` + Aliases ^^^^^^^ @@ -364,3 +370,4 @@ Sync example .. _Fragment: https://graphql.org/learn/queries/#fragments .. _Inline Fragment: https://graphql.org/learn/queries/#inline-fragments +.. _issue #308: https://github.com/graphql-python/gql/issues/308