Skip to main content

RedisGraph Python Client

Project description

license CircleCI PyPI version GitHub issues Codecov Known Vulnerabilities


Forum Discord

RedisGraph python client

Example: Using the Python Client

import redis
from redisgraph import Node, Edge, Graph, Path

r = redis.Redis(host='localhost', port=6379)

redis_graph = Graph('social', r)

john = Node(label='person', properties={'name': 'John Doe', 'age': 33, 'gender': 'male', 'status': 'single'})

japan = Node(label='country', properties={'name': 'Japan'})

edge = Edge(john, 'visited', japan, properties={'purpose': 'pleasure'})


query = """MATCH (p:person)-[v:visited {purpose:"pleasure"}]->(c:country)
		   RETURN, p.age, v.purpose,"""

result = redis_graph.query(query)

# Print resultset

# Use parameters
params = {'purpose':"pleasure"}
query = """MATCH (p:person)-[v:visited {purpose:$purpose}]->(c:country)
		   RETURN, p.age, v.purpose,"""

result = redis_graph.query(query, params)

# Print resultset

# Use query timeout to raise an exception if the query takes over 10 milliseconds
result = redis_graph.query(query, params, timeout=10)

# Iterate through resultset
for record in result.result_set:
	person_name = record[0]
	person_age = record[1]
	visit_purpose = record[2]
	country_name = record[3]
query = """MATCH p = (:person)-[:visited {purpose:"pleasure"}]->(:country) RETURN p"""

result = redis_graph.query(query)

# Iterate through resultset
for record in result.result_set:
    path = record[0]

# All done, remove graph.


Install official release

pip install redisgraph

Install latest release (Aligned with RedisGraph master)

pip install git+

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for redisgraph, version 2.2.3
Filename, size File type Python version Upload date Hashes
Filename, size redisgraph-2.2.3.tar.gz (13.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page