Skip to content

Commit 82f277f

Browse files
committed
Add extra options and bump to version 12.0.7
1 parent f972cef commit 82f277f

3 files changed

Lines changed: 19 additions & 3 deletions

File tree

.github/insert_docs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
def parameter_to_document(param):
99
return {'@type': 'Parameter', 'type': param.type, 'name': param.name, 'summary': "\n".join(param.desc)}
1010

11-
classes_to_scan = ['Client']#, 'WOQLQuery']
11+
classes_to_scan = ['Client', 'WOQLQuery']
1212
classes = []
1313

1414
for name, obj in inspect.getmembers(terminusdb_client):

terminusdb_client/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
__title__ = "terminusdb-client"
22
__description__ = "TerminusDB client library for accessing the Terminus DB API"
33
__url__ = ""
4-
__version__ = "11.1.0"
4+
__version__ = "12.0.5"
55
__build__ = 00
66
__author__ = "TerminusDB group"
77
__author_email__ = "team@terminusdb.com"

terminusdb_client/client/Client.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1480,6 +1480,8 @@ def insert_document(
14801480
last_data_version: Optional[str] = None,
14811481
compress: Union[str, int] = 1024,
14821482
raw_json: bool = False,
1483+
merge_repeats: bool = False,
1484+
overwrite: bool = False,
14831485
) -> None:
14841486
"""Inserts the specified document(s)
14851487
@@ -1499,6 +1501,10 @@ def insert_document(
14991501
If it is an integer, size of the data larger than this (in bytes) will be compress with gzip in the request (assume encoding as UTF-8, 0 = always compress). If it is `never` it will never compress the data.
15001502
raw_json : bool
15011503
Update as raw json
1504+
merge_repeats : bool
1505+
If True, duplicate document IDs in the same request are silently accepted instead of causing an error.
1506+
overwrite : bool
1507+
If True, existing documents with the same ID will be overwritten instead of causing an error. This enables upsert behavior.
15021508
15031509
Raises
15041510
------
@@ -1518,6 +1524,8 @@ def insert_document(
15181524
else:
15191525
params["full_replace"] = "false"
15201526
params["raw_json"] = "true" if raw_json else "false"
1527+
params["merge_repeats"] = "true" if merge_repeats else "false"
1528+
params["overwrite"] = "true" if overwrite else "false"
15211529

15221530
headers = self._default_headers.copy()
15231531
if last_data_version is not None:
@@ -1587,6 +1595,7 @@ def replace_document(
15871595
compress: Union[str, int] = 1024,
15881596
create: bool = False,
15891597
raw_json: bool = False,
1598+
merge_repeats: bool = False,
15901599
) -> dict:
15911600
"""Updates the specified document(s)
15921601
@@ -1606,6 +1615,8 @@ def replace_document(
16061615
Create the document if it does not yet exist.
16071616
raw_json : bool
16081617
Update as raw json
1618+
merge_repeats : bool
1619+
If True, duplicate document IDs in the same request are silently accepted instead of causing an error.
16091620
16101621
Raises
16111622
------
@@ -1617,6 +1628,7 @@ def replace_document(
16171628
params["graph_type"] = graph_type
16181629
params["create"] = "true" if create else "false"
16191630
params["raw_json"] = "true" if raw_json else "false"
1631+
params["merge_repeats"] = "true" if merge_repeats else "false"
16201632

16211633
headers = self._default_headers.copy()
16221634
if last_data_version is not None:
@@ -1667,6 +1679,7 @@ def update_document(
16671679
commit_msg: Optional[str] = None,
16681680
last_data_version: Optional[str] = None,
16691681
compress: Union[str, int] = 1024,
1682+
merge_repeats: bool = False,
16701683
) -> None:
16711684
"""Updates the specified document(s). Add the document if not existed.
16721685
@@ -1682,14 +1695,17 @@ def update_document(
16821695
Last version before the update, used to check if the document has been changed unknowingly
16831696
compress : str or int
16841697
If it is an integer, size of the data larger than this (in bytes) will be compress with gzip in the request (assume encoding as UTF-8, 0 = always compress). If it is `never` it will never compress the data.
1698+
merge_repeats : bool
1699+
If True, duplicate document IDs in the same request are silently accepted instead of causing an error.
16851700
16861701
Raises
16871702
------
16881703
InterfaceError
16891704
if the client does not connect to a database
16901705
"""
16911706
self.replace_document(
1692-
document, graph_type, commit_msg, last_data_version, compress, True
1707+
document, graph_type, commit_msg, last_data_version, compress, True,
1708+
merge_repeats=merge_repeats,
16931709
)
16941710

16951711
def delete_document(

0 commit comments

Comments
 (0)