Query time

7 views
Skip to first unread message

Jessica Marinho

unread,
Dec 30, 2016, 11:32:42 AM12/30/16
to Neo4j

I developed the following script:



from neo4j.v1 import GraphDatabase, basic_auth


driver
= GraphDatabase.driver("bolt://localhost", auth=basic_auth("neo4j", "1234"))


session
= driver.session()


session
.run("MATCH (s:Sensor)-[r]-(d:Data)-[r1]-(h:Hora)-[r2]-(p:Precipitacao) WHERE (s.IDPostgres = '54' OR s.IDPostgres = '547') AND d.vdata > '2002-12-31' AND d.vdata < '2004-01-01' RETURN s.IDPostgres, s.latitude, s.longitude,d.vdata,h.vhora,p.valor ORDER BY d.vdata;")


session
.close()
Digite o código aqui...


I want to take the the time I spent on this query.

Michael Hunger

unread,
Dec 31, 2016, 8:05:26 AM12/31/16
to ne...@googlegroups.com
You should also iterate over the results.
And you should use parameters. the OR can be rewritten as 

s.IDPostgres IN ['54','547'] AND  '2002-12-31' < d.vdata < '2004-01-01'

with params

s.IDPostgres IN {ids} AND {from} < d.vdata < {to}


Michael

--
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages