Skip to content

Commit

Permalink
update: create_graph & properties (#349)
Browse files Browse the repository at this point in the history
* update: `create_graph`

* update: `format_graph_properties`
  • Loading branch information
aMahanna authored Oct 1, 2024
1 parent 0f46b50 commit cc6646f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 11 additions & 1 deletion arango/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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)

Expand Down
2 changes: 2 additions & 0 deletions arango/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit cc6646f

Please sign in to comment.