john-theo / neolite

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NeoLite

Super light weight neo4j python driver with multi-graph support.

Installation

pip install neolite

Basic Example

from neolite import Graph

graph = Graph(host, auth=(username, password), db=db)

result = graph.cypher('''
    CREATE ( bike:Bike { weight: 10 } ) 
    CREATE ( frontWheel:Wheel { spokes: 3 } ) 
    CREATE ( backWheel:Wheel { spokes: 32 } ) 
    CREATE p1 = (bike)-[:HAS { position: 1 } ]->(frontWheel) 
    CREATE p2 = (bike)-[:HAS { position: 2 } ]->(backWheel) 
    RETURN bike, p1, p2
''')
print(result)

Advanced Usage

Show execution stats

result = graph.cypher('SOME CYPHER', stat=True)

Multiple commits in at the same time

result = graph.cypher_many([
    'SOME CYPHER',
    'ANOTHER CYPHER'
])

Get table-like results instead of graph-like ones

result = graph.cypher('SOME CYPHER', ret_type='table')

Use https over http

graph = Graph(host, encrypted=True)

About

License:MIT License


Languages

Language:Python 98.3%Language:Shell 1.7%