Validates network and driver connectivity to Neo4j Aura — first from your local machine, then from a Databricks cluster.
| Section | Test | What it proves |
|---|---|---|
| 1 | Environment Info | Runtime and Neo4j Python driver version |
| 2 | TCP Connectivity | Network path to Neo4j on port 7687 is open |
| 3 | Python Driver | Credentials work, Bolt protocol queries execute |
- Copy
.env.sampleto.envand fill in your Neo4j credentials:cp .env.sample .env
Run the connectivity test from your local machine first to verify your credentials and that Neo4j is reachable. This requires uv.
uv run connectivity_test.pyDependencies are declared inline in the script — uv run installs them automatically.
If all tests pass locally, your credentials are valid and Neo4j is accepting connections. Any failures on Databricks are then isolated to the cluster's network configuration.
Once the local test passes, run the same tests from your Databricks cluster.
-
Configure credentials using one of these options:
- Databricks Secrets: Run the setup script to store credentials as secrets, then use Option A in the notebook:
./setup.sh
- Direct values: Skip the setup script and uncomment Option B in the notebook's configuration cell, entering your credentials directly.
- Databricks Secrets: Run the setup script to store credentials as secrets, then use Option A in the notebook:
-
Import and run
neo4j_connectivity_test.ipynbin Databricks.
The neo4j Python package is not pre-installed on serverless. Install it via the Environment side panel (add neo4j as a dependency) or with a cell at the top of the notebook:
%pip install neo4j| Section | Serverless | Notes |
|---|---|---|
| 1 — Environment Info | Yes | Requires neo4j PyPI install (see above) |
| 2 — TCP Connectivity | Likely No | Uses nc (netcat) which may not be available — see workaround below |
| 3 — Python Driver | Yes | Pure Python, no JAR dependency |
If nc is not available on serverless, replace the network test with a Python socket check:
import socket, time
start = time.time()
sock = socket.create_connection((NEO4J_HOST, 7687), timeout=10)
elapsed = (time.time() - start) * 1000
sock.close()
print(f"[PASS] TCP connection established in {elapsed:.1f}ms")