I am new to Neo4j. I have setup a new local database (blank) and I have a JSON file which contains provenance data extracted from Git. I am trying to import this data into neo4j using the prov2neo python library (https://github.com/DLR-SC/prov2neo).
I have added the APOC plugin to the database. No other configuration changes are made (everything is at default setting).
Below is the python code:
from prov.model import ProvDocument
from prov2neo.client import Client
# read graph from JSON serialization
graph = ProvDocument.deserialize(source="new_combined_data.json", format="json")
#doc = prov2neo.read_doc(filepath="combined.json")
# create a client
client = Client()
# connect to your neo4j instance
client.connect(
user="neo4j",
password="password",
name="test",
address="localhost:7687",
scheme="bolt"
)
# import the document
client.import_doc(graph)
On running this, I am getting the following error:
Traceback (most recent call last):
File "c:\Users\AKSHAAGA\Documents\prov2neo_test.py", line 12, in <module>
client.connect(
File "C:\Users\AKSHAAGA\AppData\Local\Programs\Python\Python311\Lib\site-packages\prov2neo\client.py", line 96, in connect
self.add_uniqueness_constraints()
File "C:\Users\AKSHAAGA\AppData\Local\Programs\Python\Python311\Lib\site-packages\prov2neo\client.py", line 109, in add_uniqueness_constraints
if "id" not in self.graph_db.schema.get_uniqueness_constraints(label):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\AKSHAAGA\AppData\Local\Programs\Python\Python311\Lib\site-packages\py2neo\database.py", line 894, in get_uniqueness_constraints
return [k[0] for k in self._get_indexes(label, unique_only=True)]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\AKSHAAGA\AppData\Local\Programs\Python\Python311\Lib\site-packages\py2neo\database.py", line 818, in _get_indexes
result = self.graph.run("CALL db.indexes")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\AKSHAAGA\AppData\Local\Programs\Python\Python311\Lib\site-packages\py2neo\database.py", line 405, in run
return self.auto().run(cypher, parameters, **kwparameters)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\AKSHAAGA\AppData\Local\Programs\Python\Python311\Lib\site-packages\py2neo\database.py", line 992, in run
self._connector.pull(result, -1)
File "C:\Users\AKSHAAGA\AppData\Local\Programs\Python\Python311\Lib\site-packages\py2neo\client\__init__.py", line 1434, in pull
cx.pull(result, n=n)
File "C:\Users\AKSHAAGA\AppData\Local\Programs\Python\Python311\Lib\site-packages\py2neo\client\bolt.py", line 1001, in pull
self._audit(self._transaction)
File "C:\Users\AKSHAAGA\AppData\Local\Programs\Python\Python311\Lib\site-packages\py2neo\client\bolt.py", line 810, in _audit
task.audit()
File "C:\Users\AKSHAAGA\AppData\Local\Programs\Python\Python311\Lib\site-packages\py2neo\client\bolt.py", line 1140, in audit
item.audit()
File "C:\Users\AKSHAAGA\AppData\Local\Programs\Python\Python311\Lib\site-packages\py2neo\client\bolt.py", line 1140, in audit
item.audit()
File "C:\Users\AKSHAAGA\AppData\Local\Programs\Python\Python311\Lib\site-packages\py2neo\client\bolt.py", line 1303, in audit
raise self._failure
py2neo.errors.ClientError: [Procedure.ProcedureNotFound] There is no procedure with the name `db.indexes` registered for this database instance. Please ensure you've spelled the procedure name correctly and that the procedure is properly deployed.
I have tried looking on google but couldn't find a solution to it. Appreciate any help thanks.
Py2Neo is not maintained anymore and has not caught up with recent changes on the Neo4j server side.
CALL db.indexes
has been deprecated and removed in favor of SHOW INDEXES
.
I assume that Py2Neo tries to call the former and fails because the targeted Neo4j server does not support it anymore.
One temporary solution is to downgrade the server to 4.4, which is still an active Long Term Support version and still supports CALL db.indexes
.
The long-term, viable strategy is to either:
None of these are easy solutions. That being said, prov2neo seems to only use Py2neo for the Bolt connectivity parts, so the first long-term solution (replace Py2neo with the official Python driver) is probably the least costly one.