-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove py2neo as primary database driver #235
Conversation
At this stage a full replacement of the subgraph class makes things too complicated. Instead, we'll make new functions take in subgraphs as arguments and operate on those at a lower level.
More spot fixes
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #235 +/- ##
==========================================
+ Coverage 81.65% 81.66% +0.01%
==========================================
Files 24 25 +1
Lines 2943 3049 +106
==========================================
+ Hits 2403 2490 +87
- Misses 540 559 +19 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work @ianmkenney! Merge if you're satisfied!
graph = Graph( | ||
settings.NEO4J_URL, | ||
auth=(settings.NEO4J_USER, settings.NEO4J_PASS), | ||
name=settings.NEO4J_DBNAME, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's also drop NEO4J_DBNAME
from the settings, since we don't actually use it anywhere, such as in our execute_query
calls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind, added it back in a commit I've pushed, but in transaction
instead. Also added Neo4jStore.execute_query
method that includes use of database_
kwarg to ensure this gets passed through, and adjusted all uses of self.graph.execute_query
to use this instead.
alchemiscale/storage/statestore.py
Outdated
def __init__(self, graph: "py2neo.Graph"): | ||
self.graph: Graph = graph | ||
def __init__(self, graph: Driver): | ||
self.graph: Driver = graph | ||
self.gufe_nodes = weakref.WeakValueDictionary() | ||
|
||
@contextmanager | ||
def transaction(self, readonly=False, ignore_exceptions=False) -> Transaction: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed readonly
kwarg, since this doesn't exist in new driver.
We currently use the EOL
py2neo
library for handling communication betweenalchemiscale
and the Neo4j database. This PR removes this responsibility frompy2neo
and instead shifts it to the official Neo4j Python driver. This PR does not remove py2neo entirely since we rely heavily on thepy2neo
Subgraph
data structure and query generation.