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.1.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

neo4j_uploader-0.5.1-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: neo4j_uploader-0.5.1.tar.gz
  • Upload date:
  • Size: 14.4 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.1.tar.gz
Algorithm Hash digest
SHA256 6f6d558c935d36198448221ffc03521ee353209bb328b3a39abe18e2ef1e54bd
MD5 b53675b0ab0704a130d29b4345abb1fe
BLAKE2b-256 bff94085d7d9a7d9b0bcc3b99b276fb64c088319bc7f3a12a28a538823f46546

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neo4j_uploader-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 16.8 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 da9bd25986f5e2445044be7ae49711e527d0022bd68daa5ed6045ab76f3fdc26
MD5 de33511375db299fae1efdf3576e347a
BLAKE2b-256 d75bfb0bcb4d01f51f13d081c4f52ec443d2852516866292bb431412095772e7

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