Monday, May 20, 2024

Neo4J connecting from python, APOC installation, Database creation

 The screenshot below shows the Installation of APOC







the Project view appears by selecting add files to project and canceling that popup 

the python code to connect to the database is as below 

import os
from uuid import uuid4

from langchain.graphs import Neo4jGraph
import requests

url = "bolt://localhost:7687"
username = "neo4j"
password = "knowledgegraph123*"

graph = Neo4jGraph(
url=url,
username=username,
password=password
)

print("Constructed Graph Object")

url = "https://gist.githubusercontent.com/tomasonjo/08dc8ba0e19d592c4c3cde40dd6abcc3/raw/da8882249af3e819a80debf3160ebbb3513ee962/microservices.json"
import_query = requests.get(url).json()['query']
print("import_query is ",import_query)
graph.query(
import_query
)


No comments:

Post a Comment