Skip to content

Neo4j backend

pylpg.backend.neo4j

Neo4j backend using the official Neo4j Python driver.

Classes:

Name Description
Neo4jBackend

Backend for Neo4j databases.

Neo4jBackend

Neo4jBackend(hostname: str = 'localhost', port: int = 7687, database: str = 'neo4j', username: str = 'neo4j', password: str = 'neo4j', protocol: str = 'bolt')

Bases: Backend

Backend for Neo4j databases.

Uses UNWIND queries for batch operations, providing significant speedups over individual queries at scale.

Source code in src/pylpg/backend/neo4j.py
def __init__(
    self,
    hostname: str = "localhost",
    port: int = 7687,
    database: str = "neo4j",
    username: str = "neo4j",
    password: str = "neo4j",
    protocol: str = "bolt",
) -> None:
    uri = f"{protocol}://{hostname}:{port}"
    self._driver = neo4j.GraphDatabase.driver(uri, auth=(username, password))
    self._database = database