-
Notifications
You must be signed in to change notification settings - Fork 88
Closed
Description
Dgraph: v20.03.1
pydgraph: 20.3.0
First I tried using json format, which didn't work then I tried N-quads which is mutated using the following function:
def set_facet(client, src_uid, trg_uid, predicate, facets):
'''Set edge facets
:param client: dgraph client object
:param src_uid: dgraph source node UID
:type src_uid: str
:param trg_uid: dgraph source node UID
:type trg_uid: str
:param predicate: dgraph edge predicate
:type predicate: str
:param facets: facet key, value tuple
:type facets: ((str, str|bool|int|float), ...)
'''
nquads = '\n'.join(f'<{src_uid}> <{predicate}> <{trg_uid}> '
f'({k}={json.dumps(v)}) .' for k, v in facets)
print('FACET:', nquads)
txn = client.txn()
try:
txn.mutate(set_nquads=nquads, commit_now=True)
finally:
txn.discard()I execute my python script and verify that the nquad is logged to stdout:
FACET: <0x13a4a> <result> <0x13a24> (cached=true) .
.. and inspect the graph:
No facets to be seen, and I know the function executed. When I copy-paste the n-quad from stdout and execute a mutation query in ratel:
{
set {
<0x13a4a> <result> <0x13a24> (cached=true) .
}
}
, the graph is mutated:
Metadata
Metadata
Assignees
Labels
No labels


