Skip to main content

license CircleCI PyPI version GitHub issues Codecov Known Vulnerabilities Total alerts

redisgraph-py

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'})
redis_graph.add_node(john)

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

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

redis_graph.commit()

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

result = redis_graph.query(query)

# Print resultset
result.pretty_print()

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

result = redis_graph.query(query, params)

# Print resultset
result.pretty_print()

# 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]
    print(path)


# All done, remove graph.
redis_graph.delete()

Installing

Install official release

pip install redisgraph

Install latest release (Aligned with RedisGraph master)

pip install git+https://github.com/RedisGraph/redisgraph-py.git@master

Install for development in env

  1. Create a virtualenv to manage your python dependencies, and ensure it's active. virtualenv -v venv; source venv/bin/activate

  2. Install pypoetry to manage your dependencies. pip install poetry

  3. Install dependencies. poetry install

tox runs all code linters as its default target.

Release files for redisgraph 2.4.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for redisgraph 2.4.4
File Size Uploaded
redisgraph-2.4.4.tar.gz 13.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for redisgraph 2.4.4
File Interpreter ABI Platform
redisgraph-2.4.4-py3-none-any.whl Python 3 none any Details

Total release size: 27.7 kB

Release files / redisgraph-2.4.4.tar.gz

Download URL redisgraph-2.4.4.tar.gz
Size 13.5 kB
Tags Source
SHA-256 checksum
How to use checksums
bcc1d52d77e932a16ab1b43f907845dfe8acf5fdffc671b9cc94bb53e3c7c9fe
BLAKE2b-256 checksum
How to use checksums
0e151d1f01473ce8b20a20d2dba137851c5efdd26ae0c999b9e6311814fd98b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.7.12 Linux/5.11.0-1022-azure

Release files / redisgraph-2.4.4-py3-none-any.whl

Download URL redisgraph-2.4.4-py3-none-any.whl
Size 14.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
08918de67672491e585b199a6688af165de2106f09ca6483e603108f84b1b6ae
BLAKE2b-256 checksum
How to use checksums
60667e384fa234546db6215277f6e8de36495bc205d562831d792b09bfb47e57
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.7.12 Linux/5.11.0-1022-azure

Release history Release notifications | RSS feed

This release

2.4.4 This release

2 release files

2.4.3

2 release files

2.4.2

2 release files

2.4.1

2 release files

2.4.0

2 release files

2.3.0

1 release file

2.2.4

1 release file

2.2.3

1 release file

2.1.5

2 release files

2.1.4

1 release file

2.1.3

1 release file

2.1.2

1 release file

2.1.1

1 release file

2.1

1 release file

2.0

1 release file

1.7

1 release file

1.6

1 release file

1.5

1 release file

1.4

1 release file

1.3

1 release file

1.2

1 release file

1.1

1 release file

1.0

1 release file

0.9

1 release file

0.8

1 release file

0.6

1 release file

0.5

1 release file

0.4

1 release file

0.3

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page