File size: 541 Bytes
34367da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from neo4j import GraphDatabase
d = GraphDatabase.driver(
    'neo4j+s://054eff27.databases.neo4j.io',
    auth=('neo4j', 'Qrt37mkb0xBZ7_ts5tG1J70K2mVDGPMF2L7Njlm7cg8')
)
with d.session() as s:
    r = s.run('MATCH (d:ScribdDocument) RETURN count(d) as total').single()
    print(f"Neo4j ScribdDocuments: {r['total']}")
    
    # Sample documents
    docs = s.run('MATCH (d:ScribdDocument) RETURN d.title as title LIMIT 5').data()
    print("\nSample documents:")
    for doc in docs:
        print(f"  - {doc['title'][:60]}...")
d.close()