Skip to content

Commit d9d9edd

Browse files
committed
add graph properties
1 parent bcfa397 commit d9d9edd

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

arango/database.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,8 +1165,11 @@ def create_graph(
11651165
edge_definitions: Optional[Sequence[Json]] = None,
11661166
orphan_collections: Optional[Sequence[str]] = None,
11671167
smart: Optional[bool] = None,
1168+
disjoint: Optional[bool] = None,
11681169
smart_field: Optional[str] = None,
11691170
shard_count: Optional[int] = None,
1171+
replication_factor: Optional[int] = None,
1172+
write_concern: Optional[int] = None,
11701173
) -> Result[Graph]:
11711174
"""Create a new graph.
11721175
@@ -1184,6 +1187,10 @@ def create_graph(
11841187
**smart_field** below). Applies only to enterprise version of
11851188
ArangoDB.
11861189
:type smart: bool | None
1190+
:param disjoint: If set to True, create a disjoint SmartGraph instead
1191+
of a regular SmartGraph. Applies only to enterprise version of
1192+
ArangoDB.
1193+
:type disjoint: bool | None
11871194
:param smart_field: Document field used to shard the vertices of the
11881195
graph. To use this, parameter **smart** must be set to True and
11891196
every vertex in the graph must have the smart field. Applies only
@@ -1195,6 +1202,21 @@ def create_graph(
11951202
cannot be modified later once set. Applies only to enterprise
11961203
version of ArangoDB.
11971204
:type shard_count: int | None
1205+
:param replication_factor: Number of copies of each shard on different
1206+
servers in a cluster. Allowed values are 1 (only one copy is kept
1207+
and no synchronous replication), and n (n-1 replicas are kept and
1208+
any two copies are replicated across servers synchronously, meaning
1209+
every write to the master is copied to all slaves before operation
1210+
is reported successful).
1211+
:type replication_factor: int
1212+
:param write_concern: Write concern for the collection. Determines how
1213+
many copies of each shard are required to be in sync on different
1214+
DBServers. If there are less than these many copies in the cluster
1215+
a shard will refuse to write. Writes to shards with enough
1216+
up-to-date copies will succeed at the same time. The value of this
1217+
parameter cannot be larger than that of **replication_factor**.
1218+
Default value is 1. Used for clusters only.
1219+
:type write_concern: int
11981220
:return: Graph API wrapper.
11991221
:rtype: arango.graph.Graph
12001222
:raise arango.exceptions.GraphCreateError: If create fails.
@@ -1223,10 +1245,16 @@ def create_graph(
12231245
data["orphanCollections"] = orphan_collections
12241246
if smart is not None: # pragma: no cover
12251247
data["isSmart"] = smart
1248+
if disjoint is not None: # pragma: no cover
1249+
data["isDisjoint"] = disjoint
12261250
if smart_field is not None: # pragma: no cover
12271251
data["options"]["smartGraphAttribute"] = smart_field
12281252
if shard_count is not None: # pragma: no cover
12291253
data["options"]["numberOfShards"] = shard_count
1254+
if replication_factor is not None: # pragma: no cover
1255+
data["options"]["replicationFactor"] = replication_factor
1256+
if write_concern is not None: # pragma: no cover
1257+
data["options"]["writeConcern"] = write_concern
12301258

12311259
request = Request(method="post", endpoint="/_api/gharial", data=data)
12321260

0 commit comments

Comments
 (0)