diff --git a/CHANGELOG.md b/CHANGELOG.md index b1450d8e7..821d10609 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Development] ### Docs -* Update Python remote mode notebook: Fixed engine results +* Python remote mode notebook: Fixed engine results +* Python remote mode: Add JSON example ## [0.35.1 - 2024-12-11] diff --git a/docs/source/gfql/remote.rst b/docs/source/gfql/remote.rst index ac19b930c..ad3f040cd 100644 --- a/docs/source/gfql/remote.rst +++ b/docs/source/gfql/remote.rst @@ -192,3 +192,19 @@ Run Python on an existing graph, return a table assert len(some_edges_df) == 10 + +Run Python on an existing graph, return JSON +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + import graphistry + + g = graphistry.bind(dataset_id='ds-abc-123') + + def first_n_edges_shape(g): + return {'num_edges': len(g._edges[:10])} + + obj = g.remote_python_json(first_n_edges_shape) + + assert obj['num_edges'] == 10