Merge branch 'dev' into check-permissions-on-dataset-fix

This commit is contained in:
Igor Ilic 2025-06-25 23:20:38 +02:00 committed by GitHub
commit 629b21528d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 27 additions and 14 deletions

View file

@ -77,15 +77,15 @@ def create_graph_engine(
)
if graph_database_provider == "neo4j":
if not (graph_database_url and graph_database_username and graph_database_password):
raise EnvironmentError("Missing required Neo4j credentials.")
if not graph_database_url:
raise EnvironmentError("Missing required Neo4j URL.")
from .neo4j_driver.adapter import Neo4jAdapter
return Neo4jAdapter(
graph_database_url=graph_database_url,
graph_database_username=graph_database_username,
graph_database_password=graph_database_password,
graph_database_username=graph_database_username or None,
graph_database_password=graph_database_password or None,
)
elif graph_database_provider == "falkordb":
@ -124,15 +124,15 @@ def create_graph_engine(
)
elif graph_database_provider == "memgraph":
if not (graph_database_url and graph_database_username and graph_database_password):
raise EnvironmentError("Missing required Memgraph credentials.")
if not graph_database_url:
raise EnvironmentError("Missing required Memgraph URL.")
from .memgraph.memgraph_adapter import MemgraphAdapter
return MemgraphAdapter(
graph_database_url=graph_database_url,
graph_database_username=graph_database_username,
graph_database_password=graph_database_password,
graph_database_username=graph_database_username or None,
graph_database_password=graph_database_password or None,
)
from .networkx.adapter import NetworkXAdapter

View file

@ -58,13 +58,18 @@ class MemgraphAdapter(GraphDBInterface):
def __init__(
self,
graph_database_url: str,
graph_database_username: str,
graph_database_password: str,
graph_database_username: Optional[str] = None,
graph_database_password: Optional[str] = None,
driver: Optional[Any] = None,
):
# Only use auth if both username and password are provided
auth = None
if graph_database_username and graph_database_password:
auth = (graph_database_username, graph_database_password)
self.driver = driver or AsyncGraphDatabase.driver(
graph_database_url,
auth=(graph_database_username, graph_database_password),
auth=auth,
max_connection_lifetime=120,
)

View file

@ -40,13 +40,21 @@ class Neo4jAdapter(GraphDBInterface):
def __init__(
self,
graph_database_url: str,
graph_database_username: str,
graph_database_password: str,
graph_database_username: Optional[str] = None,
graph_database_password: Optional[str] = None,
driver: Optional[Any] = None,
):
# Only use auth if both username and password are provided
auth = None
if graph_database_username and graph_database_password:
auth = (graph_database_username, graph_database_password)
elif graph_database_username or graph_database_password:
logger = get_logger(__name__)
logger.warning("Neo4j credentials incomplete falling back to anonymous connection.")
self.driver = driver or AsyncGraphDatabase.driver(
graph_database_url,
auth=(graph_database_username, graph_database_password),
auth=auth,
max_connection_lifetime=120,
notifications_min_severity="OFF",
)