Skip to content

Commit

Permalink
Add doc and changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusconjeaud committed Nov 22, 2024
1 parent d1720df commit a13697f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Version 5.4.1 2024-11
* Add options for intermediate_transform : distinct, include_in_return, use a prop as source

Version 5.4.0 2024-11
* Traversal option for filtering and ordering
* Insert raw Cypher for ordering
Expand Down
31 changes: 31 additions & 0 deletions doc/source/advanced_query_operations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,37 @@ As discussed in the note above, this is for example useful when you need to orde
)
.annotate(supps=Last(Collect("suppliers")))

Options for `intermediate_transform` *variables* are:

- `source`: `string`or `Resolver` - the variable to use as source for the transformation. Works with resolvers (see below).
- `source_prop`: `string` - optionally, a property of the source variable to use as source for the transformation.
- `include_in_return`: `bool` - whether to include the variable in the return statement. Defaults to False.

Additional options for the `intermediate_transform` method are:
- `distinct`: `bool` - whether to deduplicate the results. Defaults to False.

Here is a full example::

await Coffee.nodes.fetch_relations("suppliers")
.intermediate_transform(
{
"coffee": "coffee",
"suppliers": NodeNameResolver("suppliers"),
"r": RelationNameResolver("suppliers"),
"coffee": {"source": "coffee", "include_in_return": True}, # Only coffee will be returned
"suppliers": {"source": NodeNameResolver("suppliers")},
"r": {"source": RelationNameResolver("suppliers")},
"cost": {
"source": NodeNameResolver("suppliers"),
"source_prop": "delivery_cost",
},
},
distinct=True,
ordering=["-r.since"],
)
.annotate(oldest_supplier=Last(Collect("suppliers")))
.all()

Subqueries
----------

Expand Down

0 comments on commit a13697f

Please sign in to comment.