Skip to main content

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)

Documentation

Documentation for the current version.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

neo4j_uploader-0.5.2.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

neo4j_uploader-0.5.2-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file neo4j_uploader-0.5.2.tar.gz.

File metadata

  • Download URL: neo4j_uploader-0.5.2.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.3 Darwin/23.1.0

File hashes

Hashes for neo4j_uploader-0.5.2.tar.gz
Algorithm Hash digest
SHA256 06d2502832b0c983ce373dac46e1538e1ebe73e1b3436d3bec6e760128129fa4
MD5 02558440cb1c594b327e3f2be959d6fe
BLAKE2b-256 a938b1156d2264fc27b099a3ba77d7bdafcea0e237920c135369b1630eafdccd

See more details on using hashes here.

File details

Details for the file neo4j_uploader-0.5.2-py3-none-any.whl.

File metadata

  • Download URL: neo4j_uploader-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 17.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.3 Darwin/23.1.0

File hashes

Hashes for neo4j_uploader-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 41e03985c55088283a36a8bac03e63794b45089ca95fbb975aebfa482af01812
MD5 d3b0e8ca080670199b9ba9d41194c38b
BLAKE2b-256 d9acf068ad6042bf8dab57e44b41500da6bc2a8603e9240e6817ff9ae1839c66

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page