Skip to content

Feature: neo4j importer#12

Merged
avisionh merged 19 commits intomainfrom
feature/neo4j-importer
Jun 4, 2021
Merged

Feature: neo4j importer#12
avisionh merged 19 commits intomainfrom
feature/neo4j-importer

Conversation

@avisionh
Copy link
Owner

@avisionh avisionh commented May 26, 2021

Summary

This branch establishes the functions that write the Cypher queries to take the created data and manually imports into the neo4j graph database.

Changes

The high-level changes made in this PR are:

  1. Add example query and image in README.md.
  2. Create functions to write Cypher queries.

Please see the commit history for more detailed changes.


Check

  • The documentation is clear on setting-up and using neo4j in the README.md.
  • The test suite passes via running the below:
python -m pytest tests/
  • The GitHub Actions checks pass.

Note

This "fixes #4" and "fixes #6".

This branch does not quite achieve the objective of being able to run commands from the terminal into the neo4j Docker container but you can achieve this through Python itself. This is to do with the call to bolt://localhost:7687 being incorrect. We should swap localhost with the IP address of the Docker container.

avisionh added 3 commits May 26, 2021 08:11
This is so users can replicate the example correctly.

Ignore the sqlquerygraph.py file from code coverage. This is because it is a collection of other code that has been tested.
This is so we can load data into the neo4j graph database.
This is so we can get some data into the database in the case where there is a rogue line that aborts the import.

This is useful when the .csv files have about hundreds or thousands of rows. This will also reduce the memory overhead of the transaction state.
@codecov
Copy link

codecov bot commented May 26, 2021

Codecov Report

Merging #12 (6902804) into main (172052e) will increase coverage by 27.35%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##             main      #12       +/-   ##
===========================================
+ Coverage   49.03%   76.38%   +27.35%     
===========================================
  Files           3        3               
  Lines         155      144       -11     
  Branches       29       32        +3     
===========================================
+ Hits           76      110       +34     
+ Misses         69       24       -45     
  Partials       10       10               
Impacted Files Coverage Δ
writer.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 172052e...6902804. Read the comment docs.

avisionh added 16 commits May 26, 2021 08:50
This is so we can move that into the neo4j container.

Also update Cypher queries so they use :auto to avoid issues with manual importing. May not need this :auto call when using Cypher shell though.
This is so we can reference where the queries in this repo are based off.

Also innclude image of graph database that visualises the table dependencies.
This is so we can create nodes and constraints for each dataset.
This is so we can ensure they work.
This is so we can then read these scripts and create in Cypher shell.
This is so we do not create unecessary import of files that do not exist in the Cypher code.

Also simplify the aliasing to deal with cases where have two datasets that start with the same letter.
This is so the Cypher scripts are also passed into the Docker container.
This is to adhere to neo4j node naming standards.
This is so others can reproduce the graph.
This is so the tests pass.

The idea is tha the user generates the example .csv file through following the README.md.
This is so we can automate import of data.
This is to run queries in the database.
This is so we can have a separate container handling the importing of data into the database.
This is so we can apply the Python loader module on the Cypher scripts.
This is because we only need py2neo package for docker container.
This is with the understanding that docker-compose is an orchestrator platform in the vein of kubernetes and that the stuff trying to be done with respect to calling the module will be better done in a Dockerfile.

Currently Python module cannot connect to neo4j docker container because of hosting. Need to specify the Docker container's IP address in the module.
@avisionh avisionh marked this pull request as ready for review June 4, 2021 07:21
@avisionh avisionh merged commit 4d94f4c into main Jun 4, 2021
@avisionh avisionh deleted the feature/neo4j-importer branch June 4, 2021 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Module to export local example data into neo4j Visualise in neo4j

1 participant