Skip to content

Commit 1a1a2ee

Browse files
authored
DOC DSL add note for arguments with Python keywords (#317)
1 parent efc00f8 commit 1a1a2ee

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

docs/advanced/dsl_module.rst

+7
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@ It can also be done using the :meth:`args <gql.dsl.DSLField.args>` method::
125125

126126
ds.Query.human.args(id="1000").select(ds.Human.name)
127127

128+
.. note::
129+
If your argument name is a Python keyword (for, in, from, ...), you will receive a
130+
SyntaxError (See `issue #308`_). To fix this, you can provide the arguments by unpacking a dictionary.
131+
132+
For example, instead of using :code:`from=5`, you can use :code:`**{"from":5}`
133+
128134
Aliases
129135
^^^^^^^
130136

@@ -364,3 +370,4 @@ Sync example
364370

365371
.. _Fragment: https://graphql.org/learn/queries/#fragments
366372
.. _Inline Fragment: https://graphql.org/learn/queries/#inline-fragments
373+
.. _issue #308: https://github.com/graphql-python/gql/issues/308

0 commit comments

Comments
 (0)