Skip to content
This repository has been archived by the owner on Jul 6, 2023. It is now read-only.

Error when executing a .cypher with a :param line that contains a datetime function #286

Open
vga91 opened this issue Jan 15, 2021 · 2 comments

Comments

@vga91
Copy link

vga91 commented Jan 15, 2021

The issue neo4j-contrib/neo4j-apoc-procedures#1728 seems to be due to cypher-shell.

Steps to reproduce

Step 1 - Create a .cypher with a :param line that contains a datetime function, like this:

:begin
CREATE CONSTRAINT ON (node:`UNIQUE IMPORT LABEL`) ASSERT (node.`UNIQUE IMPORT ID`) IS UNIQUE;
:commit
:begin
:param rows => [{_id:1, properties:{created:datetime('2020-11-26T21:36:04.212Z')}}]
UNWIND $rows AS row
CREATE (n:`UNIQUE IMPORT LABEL`{`UNIQUE IMPORT ID`: row._id}) SET n += row.properties SET n:TestNode;
:commit
:begin
MATCH (n:`UNIQUE IMPORT LABEL`)  WITH n LIMIT 20000 REMOVE n:`UNIQUE IMPORT LABEL` REMOVE n.`UNIQUE IMPORT ID`;
:commit
:begin
DROP CONSTRAINT ON (node:`UNIQUE IMPORT LABEL`) ASSERT (node.`UNIQUE IMPORT ID`) IS UNIQUE;
:commit

Step 2 - Execute cat backup.cypher | cypher-shell

@klongmitre
Copy link

@vga91 - any update on this? I'm currently facing this same issue? Is there a work-around?

@michela
Copy link

michela commented Jan 23, 2023

This may be related - please advise whether I should create a separate issue.

Using the apoc.export.cypher.all function to write cypher-shell to a file and then use this file as piped input to cypher-shell (as described here)
https://neo4j.com/developer/kb/export-sub-graph-to-cypher-and-import/

Any properties of type localdatatime are ignored on input.

e.g.
{_id:6295, properties:{lastUpdated:localdatetime('2023-01-12T13:21:44.002'), starred:true, connected_on:"Oct 26)", name:"Michela Ledwidge"}}

Is there a work-around for this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants