You will be prompted for your database credentials
import set_path # Importing this module will add the project's home directory to sys.path
Added 'D:\Docs\- MY CODE (Win11)\Brain Annex\BA develop' to sys.path
import os
import sys
import getpass
from brainannex import GraphAccess
print("*** SOME DIAGNOSTIC VALUES: ***")
print("\nsys.executable: ", sys.executable)
print("\ncwd: ", os.getcwd())
#print("\nsys.path: ", sys.path)
print("\nsys.path using separate lines: ")
for p in sys.path:
print(" ", p)
*** SOME DIAGNOSTIC VALUES: ***
sys.executable: D:\Docs\- MY CODE (Win11)\Brain Annex\BA develop\venv\Scripts\python.exe
cwd: D:\Docs\- MY CODE (Win11)\Brain Annex\BA develop\notebooks
sys.path using separate lines:
D:\Docs\- MY CODE (Win11)\Brain Annex
C:\Program Files\Python311\python311.zip
C:\Program Files\Python311\DLLs
C:\Program Files\Python311\Lib
C:\Program Files\Python311
D:\Docs\- MY CODE (Win11)\Brain Annex\BA develop\venv
D:\Docs\- MY CODE (Win11)\Brain Annex\BA develop\venv\Lib\site-packages
D:\Docs\- MY CODE (Win11)\Brain Annex\BA develop
NOTE: This tutorial is tested on version 4 of the Neo4j database, but will probably also work on the new version 5# Connect to the database
# Save your credentials here - or use the prompts given by the next cell
host = "neo4j://localhost" # EXAMPLES: bolt://123.456.789.012 OR neo4j://localhost
password = ""
print("To create a database connection, enter the host IP, but leave out the port number: (EXAMPLES: bolt://123.456.789.012 OR neo4j://localhost )\n")
host = input("Enter host IP WITHOUT the port number. EXAMPLE: bolt://123.456.789.012 ")
host += ":7687" # EXAMPLE of host value: "bolt://123.456.789.012:7687"
password = getpass.getpass("Enter the database password:")
print(f"\n=> Will be using: host='{host}', username='neo4j', password=**********")
To create a database connection, enter the host IP, but leave out the port number: (EXAMPLES: bolt://123.456.789.012 OR neo4j://localhost )
=> Will be using: host='bolt://123.456.789.012:7687', username='neo4j', password=**********
db = GraphAccess(host=host,
credentials=("neo4j", password), debug=False) # Notice the debug option being OFF
Connection to Neo4j database established.
print("Version of the Neo4j driver: ", db.version())
Version of the Neo4j driver: 4.4.13