0

I've been running this cypher

CREATE (b:Request {created_at: timestamp(), depth:$depth})"

which relies on the cypher timestamp() function. The documentation calls out

The timestamp() function returns the equivalent value of datetime().epochMillis.

meaning I could do the time calculation on the server-side, though having access to the scalar functions I'd like to know if it's A) possible, and B) if possible how to use.

b = Node("Request", created_at= timestamp(), depth= 0) did not even a little bit work.

Lost Odinson
  • 418
  • 1
  • 5
  • 14

1 Answers1

0

Note that if you do this, you are generating a timestamp client-side rather than server-side and you should be aware of the implications of this, re clock sync, etc.

That said, you'll need to pass an actual Python datetime instance (Cypher can only be evaluated server-side):

from datetime import datetime
b = Node("Request", created_at=datetime.now(), depth=0)

You'll need to make sure you're running at least py2neo 4.2 and Neo4j 3.4 for this to be available.

Nigel Small
  • 4,475
  • 1
  • 17
  • 15