[PYTHON] graphene memo

It is not completed by graphene itself, but in fact, libraries such as graphql-core and graphql-relay are hidden under graphene. GraphQL is a port of graphql-core because it has been popular under the JavaScript environment since its inception. Graphene is a python-like version of the core library graphql. When you think "there is not enough description" in the graphene document, it is actually the explanation part of the lower library. Eventually, you can find the answer by going back to the reference implementation.

The graphene field definition procedure is easy to add with mixin. The mixin style is recommended as it can be a pitfall when trying to use class inheritance.

graphene.relay: The relay itself is an additional specification based on GraphQL. Since it is widely used, it is less confusing to deal with it basically. The interfaces Connection and Node stand out.

Node interface With Node, you can pull a single object from ʻid` via node query. Since it is not visible by default, Prepare as needed. If such an access path is not desirable (for security reasons, for example), implementation may be omitted.

You can import with graphene.Node without accessing with graphene.relay.Node.

Connection interface Total_count of Connection is not supported by the library. If you take care of it separately, there will be less trouble. For example, graphene-sqlalchemy may have to be derived from the query object, so it is presumed that it is quarantined.

https://github.com/graphql-python/graphene/issues/776 https://github.com/graphql-python/graphene-django/issues/162

With relay.Connection support, the metadata on the relay.Node side is supposed to declare that it supports Node interfaces. In graphene_sqlalchemy.SQLAlchemyConnection, if you put aNode interface declaration, it will cause a double definition, so do it well (currently it seems good to survive with a hack-like response).

You can get out of the declaration order trap by delaying the first argument of ConnectionField with lambda :.

Recommended Posts

graphene memo
gzip memo
Raspberry-pi memo
Pandas memo
HackerRank memo
Python memo
python memo
Flask memo
pyenv memo
Matplotlib memo
pytest memo
sed memo
Python memo
Install Memo
BeautifulSoup4 memo
networkx memo
python memo
tomcat memo
command memo
Generator memo.
psycopg2 memo
Python memo
SSH memo
Command memo
Memo: rtl8812
pandas memo
Shell memo
Python memo
Pycharm memo
Python memo
AtCoder devotion memo (11/12)
[OpenCV] Personal memo
[Python] Memo dictionary
PyPI push memo
tensorflow-gpu introduction memo
LPIC201 learning memo
Jupyter Notebook memo
LPIC304 virtualization memo
ALDA execution memo
python beginner memo (9.2-10)
youtube download memo
Linux x memo
Django Learning Memo
ARC # 016 Participation memo
Beautiful Soup memo
LPIC101 study memo
python beginner memo (9.1)
linux (ubuntu) memo
scp command memo
Flask Primer Memo
celery / kombu memo
who command memo
django tutorial memo
Flask basic memo
Linux # Command Memo 1
★ Memo ★ Python Iroha
Gender recognition memo
Image reading memo
[MEMO] [TERMINAL] Alacritty
3D rotation memo (1)
[Python] EDA memo