No project description provided
Project description
Neo4j-uploader
For uploading specially formatted dictionary data to a Neo4j database instance.
Installation
pip install neo4j-uploader
Usage
from neo4j_uploader import batch_upload
config = {
"neo4j_uri": "<NEO4J_URI>",
"neo4j_user": "<NEO4J_USER>",
"neo4j_password": "<NEO4J_PASSWORD>",
"overwrite": true
}
data = {
"nodes": [
{
"labels":["Person"],
"key":"uid",
"records":[
{
"uid":"abc",
"name": "John Wick"
},
{
"uid":"bcd",
"name":"Cane"
}
]
},
{
"labels":["Dog"],
"key": "gid",
"records":[
{
"gid":"abc",
"name": "Daisy"
}
]
}
],
"relationships": [
{
"type":"LOVES",
"from_node": {
"record_key":"_from_uid",
"node_key":"uid",
"node_label":"Person"
},
"to_node": {
"record_key":"_to_gid",
"node_key":"gid",
"node_label": "Dog"
},
"exclude_keys":["_from_uid", "_to_gid"],
"records":[
{
"_from_uid":"abc",
"_to_gid":"abc"
}
]
}
]
}
result = batch_upload(config, data)
The original upload function using the simpler schema also still works:
from neo4j_uploader import upload
credentials = ("database_uri", "user", "password")
data = {
"nodes":
{
"Person": [
{"name": "Bob", "age": 30},
{"name": "Jane", "age": 25}
]
},
"relationships":
{
"KNOWS": [
{"_from_name": "Bob", "_to_name": "Jane", "since": 2015}
]
}
}
upload(credentials, data, node_key="name)
Progress Tracking
The batch_upload_generator function can be used as a generator. Example usage:
for result in batch_upload(config, data):
print(f"Upload progress: {result.nodes_created} nodes created")
Documentation
Documentation for the current version.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file neo4j_uploader-0.6.0.tar.gz.
File metadata
- Download URL: neo4j_uploader-0.6.0.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.12.2 Darwin/23.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0c7228add6f943a3aff98a2d1925cc29d354d4f3bfbe9a9fce5ecea33db3a3e
|
|
| MD5 |
40141f5c45b032e5c27d2a93a8acf20e
|
|
| BLAKE2b-256 |
dcfc12452f9020701835110193564f8fdf4ee913a4ac1171c12e680dc0ad9486
|
File details
Details for the file neo4j_uploader-0.6.0-py3-none-any.whl.
File metadata
- Download URL: neo4j_uploader-0.6.0-py3-none-any.whl
- Upload date:
- Size: 18.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.12.2 Darwin/23.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
239dfd7afd0bfd96778d6a96d9b900669febb99699c46802056cdb6b6df6a80b
|
|
| MD5 |
99070563549ec57a073a689b4bab6bf7
|
|
| BLAKE2b-256 |
6778a53eb1cb0d827dd9c07f31cdbfc1b0d3d1a322749d89c40e9fb20bee838f
|