Skip to content

update: create_graph & properties #349

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading