neomodel closes sessions only after object is deleted
See original GitHub issueUsing neomodel 3.2.5
I figured when using transaction with db.begin() and db.commit() it does not close the session immediately but when the object itself is being destroyed.
I used the following test to determine when the session is being close by using logging’s output to check when the object is being deleted (before the tearDown() or after) in test_session_closing_neomodel -> it closes session only after deleted in test_session_closing_neodriver -> it closes session when transaction is ended
import unittest
import logging
from neomodel import db
from neo4j.v1 import GraphDatabase
logging.basicConfig(level=logging.DEBUG)
class NeoTest(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_session_closing_neomodel(self):
db.set_connection("bolt://neo4j:neo4j@localhost:7687")
db.begin()
db.cypher_query("MATCH (n) RETURN n")
db.commit()
def test_session_closing_neodriver(self):
driver = GraphDatabase.driver("bolt://localhost:7687", auth=("neo4j", "neo4j"))
with driver.session() as session:
with session.begin_transaction() as tx:
tx.run("MATCH (n) RETURN n")
tx.commit()
Issue Analytics
- State:
- Created 6 years ago
- Comments:8
Top Results From Across the Web
Modules documentation — neomodel 4.0.8 documentation
A singleton object via which all operations from neomodel to the Neo4j backend are ... specify True to get nodes with id only...
Read more >neomodel doesn't save nodes in database - Stack Overflow
I found that when I create a User instance using cypher from neo4j console, User.nodes.all() returns such instance. So I guess the problem...
Read more >Delete Endpoints and Resources - Amazon SageMaker
SageMaker frees up all of the resources that were deployed when the endpoint ... Deleting a SageMaker model only deletes the model entry...
Read more >Object-Relational Mapping as a Persistence Mechanism for ...
The capacity to do so is called persistence. Without persistence, data exists only in memory and is lost when the computer shuts down....
Read more >neomodel 1.0.1 - PyPI
An object mapper for the neo4j graph database. ... pip install neomodel==1.0.1 ... happens here jim.delete() jim.refresh() # reload properties from neo.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@liranbg Right, sounds good, I have marked it as an enhancement and hope to see it taken care of relatively soon.
All the best
Thanks for raising this issue. Coupled to it is also the issue with the connection clean up causing some strange exceptions in neo4j_drivers destructor. Spent a while trying to figure it out to no avail but will let you know as soon as I find a solution