Have been trying to run query neo4j database using python. The code works for simplest of queries, but not for all. I dont get any exception, and the dont understand the root cause going by log files.
My code looks like this..
from neo4j.v1 import GraphDatabase, basic_auth
graph_url = "bolt://localhost:7687"
graph_username = "neo4j"
graph_password = "neo4j"
driver =GraphDatabase.driver(graph_url, auth=basic_auth(graph_username, graph_password))
session = driver.session()
query_simple="Create (enitity:n{name : 'john doe'})"
session.run(query_simple)
query = "LOAD CSV WITH HEADERS FROM 'http://data.neo4j.com/northwind/products.csv' AS row CREATE (n:Product) SET n = row n.unitPrice = toFloat(row.unitPrice), n.unitsInStock = toInt(row.unitsInStock), n.unitsOnOrder = toInt(row.unitsOnOrder), n.reorderLevel = toInt(row.reorderLevel), n.discontinued = (row.discontinued <> '0')"
session.run(query)
the simple query runs fine, but the other query doesnt run. Its a sample query which works on the neo4j gui on my local host
in the debug log files i am getting these two kind of error logs:
2016-07-06 22:14:27.062+0000 ERROR [o.n.b.v.t.BoltProtocolV1] Failed to write response to driver
java.lang.NullPointerException at org.neo4j.bolt.v1.transport.ChunkedOutput.ensure(ChunkedOutput.java:156) at org.neo4j.bolt.v1.transport.ChunkedOutput.writeShort(ChunkedOutput.java:90) at org.neo4j.bolt.v1.packstream.PackStream$Packer.packStructHeader(PackStream.java:304) at org.neo4j.bolt.v1.messaging.PackStreamMessageFormatV1$Writer.handleFailureMessage(PackStreamMessageFormatV1.java:154) at org.neo4j.bolt.v1.messaging.msgprocess.MessageProcessingCallback.publishError(MessageProcessingCallback.java:48) at org.neo4j.bolt.v1.messaging.msgprocess.MessageProcessingCallback.completed(MessageProcessingCallback.java:98) at org.neo4j.bolt.v1.messaging.msgprocess.MessageProcessingCallback.completed(MessageProcessingCallback.java:31) at org.neo4j.bolt.v1.runtime.internal.SessionStateMachine.after(SessionStateMachine.java:823) at org.neo4j.bolt.v1.runtime.internal.SessionStateMachine.run(SessionStateMachine.java:655) at org.neo4j.bolt.v1.runtime.internal.concurrent.SessionWorkerFacade.lambda$run$3(SessionWorkerFacade.java:68) at org.neo4j.bolt.v1.runtime.internal.concurrent.SessionWorker.execute(SessionWorker.java:116) at org.neo4j.bolt.v1.runtime.internal.concurrent.SessionWorker.run(SessionWorker.java:77) at java.lang.Thread.run(Thread.java:745)
and
2016-07-06 20:52:20.588+0000 ERROR [o.n.b.t.SocketTransportHandler] Fatal error occurred when handling a client connection: Connection reset by peer Connection reset by peer java.io.IOException: Connection reset by peer at sun.nio.ch.FileDispatcherImpl.read0(Native Method) at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) at sun.nio.ch.IOUtil.read(IOUtil.java:192) at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380) at io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:311) at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:881) at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:242) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:119) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111) at java.lang.Thread.run(Thread.java:745)
I am using a community edition of neo4j on my system, python version 3.5
Thanks in advance :)