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

Uploaded Source

Built Distribution

neo4j_uploader-0.5.3-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: neo4j_uploader-0.5.3.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.2.0

File hashes

Hashes for neo4j_uploader-0.5.3.tar.gz
Algorithm Hash digest
SHA256 0fc92d38fc23dc72820ac9fee6c33f163a699de450fd1447c55eb8b074d77e48
MD5 86effbec8989f76bf7aee6ec2e519297
BLAKE2b-256 13cb76bc5afe7856f715cee2959a39794c68f8e7b9a949efc1cc9a1605d5395f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for neo4j_uploader-0.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 60ea4c80783816c5fe3d79c1566eb2bae53fad352cdae5dd537edeee64eacf76
MD5 55d73c4d173a36b97c402f175a424965
BLAKE2b-256 594c4fae6361d207dfbce7121e8d02f0eaf987f26861f16728f7b1ede65042cc

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