Skip to content

neo4j

Low-Level Graph Database Connection Management.

Provides functions and decorators for managing connections to a graph database using the Neo4j driver.

Example
@neo4j_session
def get_user_by_id(session: NJSession, user_id: str) -> dict:
    query = "MATCH (u:User {id: $user_id}) RETURN u"
    result = session.run(query, user_id=user_id)
    return result.single().get("u")
Note

The framework uses Memgraph as the default graph database, which is compatible with the Neo4j client libraries.

Attributes

driver module-attribute

driver = None

Functions

create_neo4j_session

create_neo4j_session(
    **kwargs,
) -> Generator[Session, None, None]

nj_session

nj_session(func: Callable) -> Callable