Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

License

NotificationsYou must be signed in to change notification settings

jalakoo/neo4j-uploader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

For uploading specially formatted dictionary data to a Neo4j database instance.

Installation

pip install neo4j-uploader

Usage

from neo4j_uploader import batch_uploadconfig = {    "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 originalupload function using the simpler schema also still works:

from neo4j_uploader import uploadcredentials = ("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

Thebatch_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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp