Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
FastApi-Neo4j
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
khusraj.jain
FastApi-Neo4j
Commits
0bdf4dee
Commit
0bdf4dee
authored
Nov 10, 2022
by
harshavardhan.c
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add: Graph changes.
parent
b4927861
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
4 deletions
+17
-4
scripts/core/engine/__init__.py
scripts/core/engine/__init__.py
+3
-2
scripts/schemas/__init__.py
scripts/schemas/__init__.py
+1
-1
scripts/utils/graph_utility.py
scripts/utils/graph_utility.py
+13
-1
No files found.
scripts/core/engine/__init__.py
View file @
0bdf4dee
...
...
@@ -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
scripts/schemas/__init__.py
View file @
0bdf4dee
...
...
@@ -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
scripts/utils/graph_utility.py
View file @
0bdf4dee
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment