Skip to main content

A Luigi Target implementation for Neo4j.

Project description

luigi-neo4j-target

A Luigi Target implementation for Neo4j

Installation

Install the package via pip:

pip install luigi-neo4j-target

Usage

Basic usage

from luigi_chromadb_target import ChromaTarget
import neo4j

uri = "bolt://localhost:7687"
driver = neo4j.GraphDatabase.driver(uri, auth=("neo4j", "neo4j"))
target = Neo4jTarget(driver, 'sample_graph')

alice = Node(label="Person", properties={"name": "Alice", "age": 30})
bob = Node(label="Person", properties={"name": "Bob", "age": 25})
friendship = Relationship(start_node=alice, end_node=bob, rel_type="FRIENDS_WITH")

graph = Graph()
graph.add_node(alice)
graph.add_node(bob)
graph.add_relationship(friendship)

target.put(graph)

g = target.get()
print(g)

Advanced options

def my_marshaler(g:str) -> Graph:
    # a logic to transform g string into a Graph
    return Graph

def my_unmarshaler(g:Graph) -> str:
    # a logic to transform Graph g into a string
    return '{my-string-graph-representation}'

target = Neo4jTarget(
    driver,
    'sample_graph',
    marshaler=my_marshaler,
    unmarshaler=my_unmarshaler)

target.put('{my-string-graph-representation}')

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

luigi_neo4j_target-1.1.0.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

luigi_neo4j_target-1.1.0-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file luigi_neo4j_target-1.1.0.tar.gz.

File metadata

  • Download URL: luigi_neo4j_target-1.1.0.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for luigi_neo4j_target-1.1.0.tar.gz
Algorithm Hash digest
SHA256 2a567b90cde82b5edb69e6552988ae3f6792f04330715f0dab359d9b19942f98
MD5 faa5b5454c0873779d47188cb673760d
BLAKE2b-256 0b631e5b86f138549e014da72a96ec042b189893180d3afdf1beff6e55cc44f9

See more details on using hashes here.

File details

Details for the file luigi_neo4j_target-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for luigi_neo4j_target-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d2aa1da27a0c897b60fd9c2f88e250f0f484841715f057a6715e0e56036ea731
MD5 f6772fd05c9f5e7c4367ffca964b30c7
BLAKE2b-256 d055b1bebac43ecf61ff458f8fc14475f0f0c34feed440c4f36b659dc52c0d34

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