Unable to rollback transaction: authentication failure while running a multi-merge multi-create query

cypher
operations

(Bharat Ram Ammu) #1

Hi, while I am running the following multi merge, multi create query:

USING PERIODIC COMMIT 10000
LOAD CSV WITH HEADERS FROM "file:///Transactions_with_risk_scores.csv" AS line
WITH line, SPLIT(line.VALUE_DATE, "/") AS date
WHERE line.TRANSACTION_ID IS NOT NULL AND line.VALUE_DATE IS NOT NULL
MATCH (transaction:Transaction),(cust:Customer)
// Match Customer and Transaction nodes

MERGE (orig: Originator { name: line.F50_ORIGINATOR} ) SET
orig.ctry_code = line.F50_ORIGINATOR_CTRY_CODE,
orig.offshore_flag = line.F50_ORIGINATOR_OFFS_FLAG

MERGE (benf: Beneficiary {name : line.F59_BENEFICIARY } ) SET
benf.ctry_code = line.F59_BENEFICIARY_CTRY_CODE,
benf.offshore_flag = line.F59_BENEFICIARY_OFFS_FLAG

MERGE (ord_bank : Ordering_Bank {name: line.F52_ORDERING_BANK }) SET
ord_bank.ctry_code = line.F52_ORDERING_BANK_CTRY_CODE,
ord_bank.offshore_flag = line.F52_ORDERING_BANK_OFFS_FLAG

CREATE (transaction)-[:AGAINST]->(cust)
CREATE (orig)-[:MEDIATED_ON]-> (ord_bank)
CREATE (ord_bank) -[:MEDIATED_TO]->(benf)
CREATE (transaction) -[:INITIATED_BY]->(orig)
CREATE (transaction) -[:FINISHED_AT]->(orig)
CREATE (transaction) -[:MEDIATED_BY]->(ord_bank)

MERGE (source_code : Source_system_code { code: line.SOURCE_SYSTEM_CODE})
MERGE (source_subcode : Source_system_subcode { code: line.SOURCE_SYSTEM_SUB_CODE})

CREATE (transaction) -[:OF_CATEGORY]-> (source_code)
CREATE (transaction) -[:OF_SUBCATEGORY]-> (source_subcode)
CREATE (source_subcode) <-[:SUBCODE_OF]- (source_code)

I get the following error logs and the transaction is unable to rollback:

2019-01-18 15:52:04.467+0000 WARN  The client is unauthorized due to authentication failure.
2019-01-18 16:36:46.888+0000 ERROR Client triggered an unexpected error [Neo.DatabaseError.General.UnknownError]: Unable to rollback transaction, reference 840fff14-66e7-40ac-9ae8-bbb96cbb5870.

It is weird because it happened first while running in Chrome browser, was assuming it is related to external connection issues. Currently, the issue pops up in Neo4j Browser. Using neo4j 3.5.1 on desktop 1.1.13 on Windows. Thanks in advance! Immediately, I ran a more simpler query and this works:

LOAD CSV WITH HEADERS FROM "file:///Customer_profiles_March_July.csv" AS line2
MATCH (cust:Customer) where cust.id = toInteger(line2.ENTITY_SOURCE_REFERENCE_ID)
SET cust.monthly_frequency= toInteger(line2.monthly_freq),
cust.average_original_amount= toInteger(line2.avg_orig_amount),
cust.average_base_amount= toInteger(line2.avg_base_amount),
cust.stdev_original_amount= toInteger(line2.sd_orig_amount),
cust.stdev_base_amount= toInteger(line2.sd_base_amount),
cust.max_transac_made_in_1day = toInteger(line2.max_transac_in_one_day)


(Ameyasoft) #2

Hi,

MATCH (transaction:Transaction),(cust:Customer)

This selects all nodes with labels 'Transaction', and 'Customer'.

Here you have to select a 'Transaction' node with id=line.TRANSACTION_ID and a 'Customer' with id=xxx (like in the second query)

After your MATCH statement use
WITH line, transaction, cust

Try this.
-Kamal


(Bharat Ram Ammu) #3

It works, I think the key here is to use 'WITH'. Thanks @ameyasoft!