Summaries/Courses/neo4j-tutorials/test.ipynb
2023-11-13 21:07:26 +01:00

74 lines
1.5 KiB
Text

{
"cells": [
{
"cell_type": "code",
"execution_count": 10,
"id": "1f2a83e5-901d-4255-854e-fad186948d04",
"metadata": {},
"outputs": [],
"source": [
"from neo4j import GraphDatabase\n",
"\n",
"URI = \"bolt://localhost:7687\"\n",
"AUTH = (\"neo4j\",\"qw12aap_!\")\n",
"DATABASE = 'test'\n",
"\n",
"with GraphDatabase.driver(URI, auth=AUTH, database=DATABASE) as driver: \n",
" driver.verify_connectivity()"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "2734375f-b867-4194-849a-5a70c1d4f66f",
"metadata": {},
"outputs": [],
"source": [
"driver.close()"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "36d56994-8269-4ec2-a433-908415ef9d1f",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0\n"
]
}
],
"source": [
"query = \"MATCH (n) RETURN COUNT(n)\"\n",
"\n",
"with driver.session() as session:\n",
" result = session.run(query)\n",
" print(result.single()[\"COUNT(n)\"])"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}