Commit 0bdf4dee authored by harshavardhan.c's avatar harshavardhan.c

Add: Graph changes.

parent b4927861
......@@ -64,6 +64,7 @@ class GraphTraversal:
def fetch_node_data(self, graph_request: NodeFetchSchema):
try:
existing_data = self.graph_util.load_node_data_from_graph(node_data=graph_request)
existing_data = self.graph_util.get_connecting_nodes_info(input_data=graph_request)
except Exception as e:
logger.exception(f"Exception Occurred while fetching data from node")
logger.exception(f"Exception Occurred while fetching data from node - {e.args}")
raise
......@@ -16,7 +16,6 @@ class Edges(BaseModel):
rel_name: str
new_rel_name: Optional[str]
bind_to: str
bind_id: str
class Config:
allow_population_by_field_name = True
......@@ -95,3 +94,4 @@ class GraphData(BaseModel):
class GetNodeInfo(BaseModel):
project_id: str
event_id: str
......@@ -3,7 +3,7 @@ from typing import List
from gqlalchemy import GQLAlchemyError
from scripts.db.graphdb.neo4j import Neo4jHandler
from scripts.db.models import RelationShipMapper, NodePropertiesSchema, NodeFetchSchema
from scripts.db.models import RelationShipMapper, NodePropertiesSchema
from scripts.logging import logger
......@@ -69,3 +69,15 @@ class GraphUtility:
except Exception as e:
logger.exception(f'Exception Occurred while fetching the relation details -> {e.args}')
raise
def get_connecting_nodes_info(self, input_data):
try:
query = f"MATCH (a: {input_data.get('label')}'{input_data}')-[r]-(b) RETURN r,a,b;"
relation_info, input_nodes, output_nodes = self.db.execute_and_fetch(query=query)
return relation_info, input_nodes, output_nodes
except GQLAlchemyError as e:
logger.debug(f'{e.args}')
return None
except Exception as e:
logger.exception(f'Exception Occurred while fetching the connecting nodes info -> {e.args}')
raise
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment