I have put together a simple test case:
account = EmailAccount()
account.email = "some@mail"
assert db.account_by_mail("some@mail") == []
db.add_node(account)
assert db.account_by_mail(account.email) == [account]
db.delete_node(account))
assert db.account_by_mail("some@mail") == []
All goes well until the last line, where an exception is thrown:
Neo.DatabaseError.Statement.ExecutionFailure: Node 226 has been deleted
The statement executed by last line is as follows:
MATCH (account:Account) WHERE account.email = {mail} RETURN account, id(account), head(labels(account))
with parameters
{
'mail': "some@mail"
}
All of the statements are executed within same transaction(we use the py2neo Transaction class for that, wrapped in a session wrapper - db). The behavior isn't exactly in line with delete semantics (link here) as the transaction hasn't been commited and the statement is a read, not a write. Are there some other hidden constraints? Is this default behavior, and if so, can it be changed(since I assume most other dbms don't behave this way)?