MCPcopy Create free account
hub / github.com/CodeGraphContext/CodeGraphContext / Neo4jDriverWrapper

Class Neo4jDriverWrapper

src/codegraphcontext/core/database.py:32–48  ·  view source on GitHub ↗

A simple wrapper around the Neo4j Driver to inject a database name into session() calls.

Source from the content-addressed store, hash-verified

30 return f"{base}\nSuggested fixes:{suggestion_block}"
31
32class Neo4jDriverWrapper:
33 """
34 A simple wrapper around the Neo4j Driver to inject a database name into session() calls.
35 """
36 def __init__(self, driver: Driver, database: str = None):
37 self._driver = driver
38 self._database = database
39
40 def session(self, **kwargs):
41 """Proxy method to get a session from the underlying driver."""
42 if self._database and 'database' not in kwargs:
43 kwargs["database"] = self._database
44 return self._driver.session(**kwargs)
45
46 def close(self):
47 """Proxy method to close the underlying driver."""
48 self._driver.close()
49
50class DatabaseManager:
51 """

Calls

no outgoing calls