Provides IPython cell magic for dgraph remote interaction.
pip install idgraphWhile dgraph provides several useful interfaces,
I spend most of my time learning, exploring, and developing in
Jupyter. Executable documentation is
fantastic! This package abstractly provides cell magic for dgraph query,
mutation, and alteration execution. You could do the same with curl
or requests. But, the sensible defaults help make things less
verbose and tedious. (It's inspired by my experience with
itikz which proved really
beneficial.)
The easiest way to understand how this works is by following (and cloning) the tutorial notebook. It's a projection dgraph's Tour of Dgraph: A Bigger Dataset.
Load the extension with,
%load_ext idgraph
Then,
- By default,
%%dgraphassumes a query.%%dgraph --alterdoes an alteration%%dgraph --mutatedoes a mutation
- By default,
%%dgraphassumeslocalhost:8080%%dgraph --addr=remote-host:8080overrides the default- The
DGRAPH_ADDRenvironmental variable overrides default if the--addrflag isn't set
- By default, only the value associated with the
datakey in the response is shown.%%dgraph --full-respshows the full response including metadata.%%dgraph --jmespath="query"allows you to extract part of the response with a jmespath query.
- By default, each cell execution binds the extracted response to
_dgraphand the full response to_dgraph_full%%dgraph --into=namewill bind the extracted response tonameand the full response to{name}_full
- By default, the cell contents are executed.
%%dgraph --skipskips execution.- Useful for mutations that are possibly dangerous on someone else's computer.
- Jinja
- technically you can use templates in a directory. you almost certainly shouldnt though.
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.