Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

neo_sink.py constraints not created in neo4j v5+ #419

Open
frdougal opened this issue Nov 30, 2022 · 0 comments
Open

neo_sink.py constraints not created in neo4j v5+ #419

frdougal opened this issue Nov 30, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@frdougal
Copy link

Describe the bug
Neo4j 5+ changed the syntax for creating indices. The current neo_sink.py code will not generate indices before loading the data resulting in very long load times. You can see the indices never get created if you query the neo4j instance using the show indexes; command.

To Reproduce
Run through the steps to generate a TSV file containing nodes and edges. Then run the [load_tsv_to_neo4j.py] code to load the data into a neo4j v5+ instance. It will take a long time to load and each subsequent batch will take longer to load.

Expected behavior
Two things are expected to happen. 1) The load time should be the same as loading data into neo4j v4.x. 2) The neo4j v5+ instance should contain several unique indices for the id property of each node label.

Code snippets
To fix this: change line 287 of neo_sink.py to this:
query = f"CREATE CONSTRAINT IF NOT EXISTS FOR (n:{category}) REQUIRE n.id IS UNIQUE"

Additional context
You may be able to add a check to the neo_sink.py code to switch the CREATE CONSTRAINT string based on neo4j version by examining the data returned by this query:
call dbms.components() yield name, versions, edition unwind versions as version return name, version, edition;

@frdougal frdougal added the bug Something isn't working label Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant