Skip to content

Commit

Permalink
Add Optional to delete owner query
Browse files Browse the repository at this point in the history
Signed-off-by: dikshathakur3119 <[email protected]>
  • Loading branch information
dikshathakur3119 committed Sep 30, 2020
1 parent 3ee0924 commit b58669f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions metadata_service/proxy/neo4j_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,8 +552,11 @@ def delete_owner(self, *,
:return:
"""
delete_query = textwrap.dedent("""
MATCH (n1:User{key: $user_email})-[r1:OWNER_OF]->(n2:Table {key: $tbl_key})-[r2:OWNER]->(n1) DELETE r1,r2
""")
MATCH (n1:User{key: $user_email}), (n2:Table {key: $tbl_key})
OPTIONAL MATCH (n1)-[r1:OWNER_OF]->(n2)
OPTIONAL MATCH (n2)-[r2:OWNER]->(n1)
DELETE r1,r2
""")

try:
tx = self._driver.session().begin_transaction()
Expand Down

0 comments on commit b58669f

Please sign in to comment.