This is a library allows you to import csv data into neo4j database
Project description
Neo4j Big Bang the CSV importer for Neo4j
This is a python package to import csv data into neo4j database. You can import both Nodes and Relationships. You don't need to write any Cypher script at all.
What it can do
Importing Nodes
- This shell automatically detects the types of properties.
- You can choose skipping or updating if nodes already exist.
- You can choose Node labels row by row. Multiple labels are supported.
- You can set labels as your importing file name too.
Importing Relationships
- This shell automatically detects the types of properties.
- You can choose skipping or updating if relationship already exists.
- You can choose if you want to create nodes at the same time.
- You can choose Relationship type row by row.
- You can set type as your importing file name too.
Getting Started
Install this package
$ pip install neo4j-bigbang
Prepare CSV Data
Put your importing CSV file under importing
directory
Run command with environment variables
NEO4J_URI=bolt://localhost:7687 NEO4J_USER=neo4j NEO4J_PASSWORD={your-password} bigbang-node
Or set envilonment variable
export NEO4J_URI=bolt://localhost:7687 NEO4J_USER=neo4j NEO4J_PASSWORD=password
Getting Started from source
$ cd [path to this repo]
$ python -m venv .env
$ source .env/bin/activate
$ pip install -r requirements.txt
Setup your .env file under src/bigbang
directory
/src/bigbang/.env
NEO4J_URI='bolt://localhost:7687'
NEO4J_USER='neo4j'
NEO4J_PASSWORD='password'
Import Nodes from CSV
Run
$ python src/bigbang/import_nodes.py
# Case 1: Use Labels from file name Person|Employee.csv
$ python src/bigbang/import_nodes.py -n Person|Employee.csv -a
# Case 2: Update if target node already exists
$ python src/bigbang/import_nodes.py -n Person|Employee.csv -a -l Person|Teacher -p name|employee_id -u
# Case 2': Update if target node already exists ( labels should be on CSV )
$ python src/bigbang/import_nodes.py -n Person|Employee.csv -a -p name|employee_id -u
# Case 3: Skip if target node already exists
$ python src/bigbang/import_nodes.py -n Person|Employee.csv -a -l Person|Teacher -p name|employee_id
# Case 3': Skip if target node already exists ( labels should be on CSV )
$ python src/bigbang/import_nodes.py -n Person|Employee.csv -a -l -p name|employee_id
Options
-p
withspecified properties
: Unique Properties. If not set, target property will be 'neme'.-l
withspecified labels
: If set, specified labels will be targeted if already in Neo4j.-n
: Specify CSV file name. Its' required when you set-f
-a
: Set if you want to use file name as labels. If not set, labels field is required in the CSV file-f
: Force inserting node. -p and -l -u are ignored.-u
: If set, update node when it exists. ( both -l and -p are required )
Import Relationships from CSV
Run
$ python src/bigbang/import_relationships.py
# Case 1: Use Type from file name YOUR_RELATION_TYPE.csv
$ python src/bigbang/import_relationships.py -n YOUR_RELATION_TYPE.csv -a
# Case 2: Update if same type relationship already exists
$ python src/bigbang/import_relationships.py -u
# Case 3: Create relationship and nodes at once, even though nodes does not exist
$ python src/bigbang/import_relationships.py -c
Options
-u
: If set, update relationship when it exists-n
: Specify CSV file name. Its' required when you set-a
-a
: Set if you want to use file name as relationship type. If not set, type field is required in the CSV file-c
: If you want to create nodes at the same time, use this option
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
neo4j-bigbang-0.0.25.tar.gz
(14.4 kB
view details)
Built Distribution
File details
Details for the file neo4j-bigbang-0.0.25.tar.gz
.
File metadata
- Download URL: neo4j-bigbang-0.0.25.tar.gz
- Upload date:
- Size: 14.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a84728d01b70f7eb13766252aad5a59714cb321a79add90f581bd8e2841ddd80 |
|
MD5 | 08e4290c6a2aa4561bc7f0b26a93ddae |
|
BLAKE2b-256 | 377bb3da206de1140bdab62c307580aa7682b0e0b7f19593e091589d0e8bc0a3 |
File details
Details for the file neo4j_bigbang-0.0.25-py3-none-any.whl
.
File metadata
- Download URL: neo4j_bigbang-0.0.25-py3-none-any.whl
- Upload date:
- Size: 22.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7df93e5a7b40e7294bc656811573fb36de19318fdb3e7ed107b64995c94c77f6 |
|
MD5 | 30c52c8825dbfccfb610b53db75c3121 |
|
BLAKE2b-256 | d66038bfe845d66e724b312a179c3564ede7ede8c07d24d2c72b8d50817df822 |