From cc6646f9213863ab4be99fec124a3e6c13a34503 Mon Sep 17 00:00:00 2001 From: Anthony Mahanna <43019056+aMahanna@users.noreply.github.com> Date: Tue, 1 Oct 2024 08:58:40 -0400 Subject: [PATCH] update: `create_graph` & `properties` (#349) * update: `create_graph` * update: `format_graph_properties` --- arango/database.py | 12 +++++++++++- arango/formatter.py | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/arango/database.py b/arango/database.py index 6145b8f..0433c82 100644 --- a/arango/database.py +++ b/arango/database.py @@ -1697,6 +1697,7 @@ def create_graph( shard_count: Optional[int] = None, replication_factor: Optional[int] = None, write_concern: Optional[int] = None, + satellite_collections: Optional[Sequence[str]] = None, ) -> Result[Graph]: """Create a new graph. @@ -1721,7 +1722,8 @@ def create_graph( :param smart_field: Document field used to shard the vertices of the graph. To use this, parameter **smart** must be set to True and every vertex in the graph must have the smart field. Applies only - to enterprise version of ArangoDB. + to enterprise version of ArangoDB. NOTE: If this field is + None and **smart** is True, an Enterprise Graph will be created. :type smart_field: str | None :param shard_count: Number of shards used for every collection in the graph. To use this, parameter **smart** must be set to True and @@ -1744,6 +1746,12 @@ def create_graph( parameter cannot be larger than that of **replication_factor**. Default value is 1. Used for clusters only. :type write_concern: int + :param satellite_collections: An array of collection names that is + used to create SatelliteCollections for a (Disjoint) SmartGraph + using SatelliteCollections (Enterprise Edition only). Each array + element must be a string and a valid collection name. The + collection type cannot be modified later. + :type satellite_collections: [str] | None :return: Graph API wrapper. :rtype: arango.graph.Graph :raise arango.exceptions.GraphCreateError: If create fails. @@ -1784,6 +1792,8 @@ def create_graph( data["options"]["replicationFactor"] = replication_factor if write_concern is not None: # pragma: no cover data["options"]["writeConcern"] = write_concern + if satellite_collections is not None: # pragma: no cover + data["options"]["satellites"] = satellite_collections request = Request(method="post", endpoint="/_api/gharial", data=data) diff --git a/arango/formatter.py b/arango/formatter.py index 3dd6bf1..1c63bf0 100644 --- a/arango/formatter.py +++ b/arango/formatter.py @@ -1261,6 +1261,8 @@ def format_graph_properties(body: Json) -> Json: } if "isSmart" in body: result["smart"] = body["isSmart"] + if "isDisjoint" in body: + result["disjoint"] = body["isDisjoint"] if "isSatellite" in body: result["is_satellite"] = body["isSatellite"] if "smartGraphAttribute" in body: