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\Brain Annex\BA-Win7' to sys.path
import os
import sys
import getpass
from neoaccess import NeoAccess
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\Brain Annex\BA-Win7\venv\Scripts\python.exe
cwd: D:\Docs\- MY CODE\Brain Annex\BA-Win7\notebooks
sys.path using separate lines:
D:\Docs\- MY CODE\Brain Annex\BA-Win7\notebooks
D:\Docs\- MY CODE\Brain Annex\BA-Win7
C:\Program Files\Python 3.8.10\python38.zip
C:\Program Files\Python 3.8.10\DLLs
C:\Program Files\Python 3.8.10\lib
C:\Program Files\Python 3.8.10
D:\Docs\- MY CODE\Brain Annex\BA-Win7\venv
D:\Docs\- MY CODE\Brain Annex\BA-Win7\venv\lib\site-packages
D:\Docs\- MY CODE\Brain Annex\BA-Win7\venv\lib\site-packages\win32
D:\Docs\- MY CODE\Brain Annex\BA-Win7\venv\lib\site-packages\win32\lib
D:\Docs\- MY CODE\Brain Annex\BA-Win7\venv\lib\site-packages\Pythonwin
D:\Docs\- MY CODE\Brain Annex\BA-Win7
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 = "" # 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 = NeoAccess(host=host,
credentials=("neo4j", password), debug=False) # Notice the debug option being OFF
Attempting to connect to Neo4j database
print("Version of the Neo4j driver: ", db.version())
Version of the Neo4j driver: 4.4.11