cancel
Showing results for 
Search instead for 
Did you mean: 

Error while import

lrntbs
Node

Neo4j CE 3.5.15 (tested also on Neo4j EE 3.5.16)
While importing data (here is cypher script)

// BCV LOAD_ALL POC PRIVILEGE

// Create an index

// Replace:

// 'LabelName' with label to index

// 'propertyKey' with property to be indexed

CREATE INDEX ON :USER(PersonID);

CREATE INDEX ON :ROLE(RoleName);

CREATE INDEX ON :APPLICATION(ID_Application_liee);

CREATE INDEX ON :PRIVILEGE(ResourceName1);

// CREATE USERS

USING PERIODIC COMMIT 1000

LOAD CSV WITH HEADERS FROM 'file:///Users_Example.csv.neo4j' as row

WITH row

WHERE NOT row.PersonID IS NULL

FIELDTERMINATOR ';'

MERGE (n:USER {PersonID: row.PersonID})

SET n=row;

// CREATE USERS RACF

USING PERIODIC COMMIT 1000

LOAD CSV WITH HEADERS FROM 'file:///racf_user.csv.neo4j' as row FIELDTERMINATOR ';'

MERGE (n:USER {PersonID: row.USBD_NAME})

SET n+=row;

// CREATE ROLES

USING PERIODIC COMMIT 1000

LOAD CSV WITH HEADERS FROM 'file:///Roles_Example.csv.neo4j' as row FIELDTERMINATOR ';'

MERGE (n:ROLE {RoleName: row.RoleName})

SET n=row;

// CREATE ROLES RACF

USING PERIODIC COMMIT 1000

LOAD CSV WITH HEADERS FROM 'file:///racf_role.csv.neo4j' as row FIELDTERMINATOR ';'

MERGE (n:ROLE {RoleName: row.GPBD_NAME})

SET n+=row;

// CREATE PRIVILEGES

USING PERIODIC COMMIT 1000

LOAD CSV WITH HEADERS FROM 'file:///Privileges_Example.csv.neo4j' as row FIELDTERMINATOR ';'

MERGE (n:PRIVILEGE {ResourceName1: row.ResourceName1})

SET n=row;

// CREATE PRIVILEGES RACF

USING PERIODIC COMMIT 1000

LOAD CSV WITH HEADERS FROM 'file:///racf_privilege.csv.neo4j' as row FIELDTERMINATOR ';'

MATCH (n:PRIVILEGE) WHERE n.ResourceName1= row.GRBD_NAME AND n.GRBD_CLASS_NAME = row.GRBD_CLASS_NAME AND NOT(n.GRBD_CLASS_NAME STARTS WITH "A")

SET n+=row;

// CREATE APPLICATIONS

match (n:APPLICATION) SET n.Code=;

USING PERIODIC COMMIT 1000

LOAD CSV WITH HEADERS FROM 'file:///BCV_Extract_Appli.csv.neo4j' as row FIELDTERMINATOR ';'

MERGE (n:APPLICATION {ID_Application_liee: row.ID_Application_liee})

ON CREATE SET n=row

ON MATCH SET n.Code = coalesce(n.Code, ) + row.Code ;

// CREATE RH - Users properties complement

USING PERIODIC COMMIT 1000

LOAD CSV WITH HEADERS FROM 'file:///Fichier_RH.csv.neo4j' as row FIELDTERMINATOR ';'

MERGE (n:USER {PersonID: row.USERID})

SET n+=row;

// CREATE USER HAS ROLE

USING PERIODIC COMMIT 1000

LOAD CSV WITH HEADERS FROM 'file:///UsersRoles_Example.csv.neo4j' as row FIELDTERMINATOR ';'

MATCH (u:USER {PersonID: row.user_id})

MATCH (r:ROLE {RoleName: row.role_id})

MERGE (u)-[:HAS_ROLE]->(r);

// CREATE USER HAS ROLE RACF

USING PERIODIC COMMIT 1000

LOAD CSV WITH HEADERS FROM 'file:///racf_user_role.csv.neo4j' as row FIELDTERMINATOR ';'

MATCH (u:USER {PersonID: row.GPMEM_MEMBER_ID})

MATCH (r:ROLE {RoleName: row.GPMEM_NAME})

MERGE (u)-[hr:HAS_ROLE]->(r)

SET hr = row ;

// CREATE ROLE HAS PRIVILEGE

USING PERIODIC COMMIT 1000

LOAD CSV WITH HEADERS FROM 'file:///RolesPrivileges_Example.csv.neo4j' as row FIELDTERMINATOR ';'

MATCH (p:PRIVILEGE {ResourceName1: row.priv_id})

MATCH (r:ROLE {RoleName: row.role_id})

MERGE (r)-[:HAS_PRIVILEGE]->(p);

// CREATE ROLE HAS ROLE

USING PERIODIC COMMIT 1000

LOAD CSV WITH HEADERS FROM 'file:///RolesRoles_Example.csv.neo4j' as row FIELDTERMINATOR ';'

MATCH (r1:ROLE {RoleName: row.role_id})

MATCH (r2:ROLE {RoleName: row.sub_role_id})

MERGE (r1)-[:HAS_ROLE]->(r2);

// CREATE USERS HAS PRIVILEGES

USING PERIODIC COMMIT 1000

LOAD CSV WITH HEADERS FROM 'file:///UsersPrivileges_Example.csv.neo4j' as row FIELDTERMINATOR ';'

MATCH (u:USER {PersonID: row.user_id})

MATCH (p:PRIVILEGE {ResourceName1: row.priv_id})

MERGE (u)-[r:HAS_PRIVILEGE]->(p)

set r=row;

// CREATE PRIV HAS APPLI

match (p:PRIVILEGE) WITH p,

CASE p.EndpointType

WHEN "AD" THEN SPLIT(p.Description,"/")[2]

ELSE SPLIT(p.Description,"/")[0]

END as APP

MATCH (a:APPLICATION) WHERE toInteger(a.ID_Application_liee)=toInteger(APP)

MERGE (p)-[ha:HAS_APPLICATION]->(a)

SET ha.Description = p.Description
<<<<

I get the error
Neo.ClientError.Statement.SemanticError: Executing queries that use periodic commit in an open transaction is not possible.

Thanks for your help

Laurent

2 REPLIES 2

ameyasoft
Graph Maven

This error is with Periodic Commit. I see this error when I have a small set of data say 200 rows. When I commented out Using Periodic Commit the import went well.

hi
thanks for reply
I comment the use periodic commit line and tried to pass the step of creating users. Now I have an error on the merge command
// USING PERIODIC COMMIT 1000
LOAD CSV WITH HEADERS FROM 'file:///Users_Example.csv.neo4j' as row
WITH row
WHERE NOT row.PersonID IS NULL
FIELDTERMINATOR ';'
MERGE (n:USER {PersonID: row.PersonID})
SET n=row;

Neo.ClientError.Statement.SyntaxError: Invalid input 'I': expected 'r/R' or 'o/O' (line 5, column 2 (offset: 141)) "MERGE (n:USER {PersonID: row.PersonID})"

Any idea?