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

Uploaded Source

Built Distribution

neo4j_uploader-0.5.0-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: neo4j_uploader-0.5.0.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.0.tar.gz
Algorithm Hash digest
SHA256 c210c2cfb33e88ee220fa0fe1e1d08d39e2c1818732dcb629ee9215a49179513
MD5 cc44e050fc9d4e5f31a491af8b5a687e
BLAKE2b-256 0ceb2caf6e7b6c45197d674ec4006d41f3df4d4d5e928064672c43ea96d07207

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neo4j_uploader-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 16.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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3b9df2c6727a6dd274283446c7f1e716f55ce0b8c19bb439fefcfff36bce619e
MD5 b53412bdda912beac5b35b0bc0366150
BLAKE2b-256 53237d339673fe7721af9b7adc496edec1b89bd4b4311ae3e5af5311fc034acc

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