dear @rouven_bauer ,
I have modified your sample example by this way
def node_create(filename,label):
begin = timer()
print(filename,label)
print(type(filename),type(label))
path=nodesourcefolder+filename
print(path)
print("Type",type(path))
#filestring=nodesourcefolder+filename
if(isfile(path)==True):
print("valid")
with driver.session() as session:
query = """CALL apoc.periodic.iterate('CALL apoc.load.csv("%s") yield map as row return row','MERGE (p:%s) SET p = row', {batchSize:1000000, iterateList:true, parallel:true})"""%(path,label)
result = session.run(query)
print(list(result))
print(result.consume().__dict__)
end = timer()
print(end - begin)
and then called the main function like this
if __name__ == "__main__":
node_create('nodes_TEST.csv','TEST')
output is
nodes_TEST.csv TEST
<class 'str'> <class 'str'>
/usr/local/Cellar/neo4j/4.1.1/libexec/import/nodes_TEST.csv
Type <class 'str'>
valid
[<Record batches=1 total=3 timeTaken=0 committedOperations=3 failedOperations=0 failedBatches=0 retries=0 errorMessages={} batch={'total': 1, 'committed': 1, 'failed': 0, 'errors': {}} operations={'total': 3, 'committed': 3, 'failed': 0, 'errors': {}} wasTerminated=False failedParams={}>]
{'metadata': {'query': 'CALL apoc.periodic.iterate('CALL apoc.load.csv("/usr/local/Cellar/neo4j/4.1.1/libexec/import/nodes_TEST.csv") yield map as row return row','MERGE (p:TEST) SET p = row', {batchSize:1000000, iterateList:true, parallel:true})', 'parameters': {}, 'server': <neo4j.api.ServerInfo object at 0x7fb35467a150>, 't_first': 39, 'fields': ['batches', 'total', 'timeTaken', 'committedOperations', 'failedOperations', 'failedBatches', 'retries', 'errorMessages', 'batch', 'operations', 'wasTerminated', 'failedParams'], 'bookmark': 'FB:kcwQ1fL/fDQWQsua6Nc4M3vmEMkB0JA=', 'type': 'rw', 't_last': 651, 'db': 'neo4j'}, 'server': <neo4j.api.ServerInfo object at 0x7fb35467a150>, 'database': 'neo4j', 'query': 'CALL apoc.periodic.iterate('CALL apoc.load.csv("/usr/local/Cellar/neo4j/4.1.1/libexec/import/nodes_TEST.csv") yield map as row return row','MERGE (p:TEST) SET p = row', {batchSize:1000000, iterateList:true, parallel:true})', 'parameters': {}, 'query_type': 'rw', 'plan': None, 'profile': None, 'notifications': None, 'counters': {}, 'result_available_after': 39, 'result_consumed_after': 651}
0.7010458620000009
the TEST.csv file is
ID,NAME
123,abc
983,bcd
771,dfda
I have got only 771,dfda entry in TEST Node
and it is in my local pc which has actually 4.1.1 version . my EC2 instance version is 4.2.