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
Release history Release notifications | RSS feed
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)
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a567b90cde82b5edb69e6552988ae3f6792f04330715f0dab359d9b19942f98 |
|
MD5 | faa5b5454c0873779d47188cb673760d |
|
BLAKE2b-256 | 0b631e5b86f138549e014da72a96ec042b189893180d3afdf1beff6e55cc44f9 |
File details
Details for the file luigi_neo4j_target-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: luigi_neo4j_target-1.1.0-py3-none-any.whl
- Upload date:
- Size: 13.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2aa1da27a0c897b60fd9c2f88e250f0f484841715f057a6715e0e56036ea731 |
|
MD5 | f6772fd05c9f5e7c4367ffca964b30c7 |
|
BLAKE2b-256 | d055b1bebac43ecf61ff458f8fc14475f0f0c34feed440c4f36b659dc52c0d34 |