New from O’Reilly: The memory architecture behind adaptive AI agents

Read the report
For developersHow to query Graph data in Redis using Python
Ajeet Raina
Ajeet Raina

END-OF-LIFE NOTICE

Redis is phasing out RedisGraphThis blog post explains the motivation behind this decision and the implications for existing Redis customers and community members.

End of support is scheduled for January 31, 2025.

Beginning with Redis Stack 7.2.x-y, Redis Stack will no longer include graph capabilities (RedisGraph).

RedisGraph is the fastest graph database that processes complex graph operations in real time, 10x – 600x faster than any other graph database. Show how your data is connected through multiple visualization integrations including RedisInsight, Linkurious, and Graphileon. Query graphs using the industry-standard Cypher query language and easily use graph capabilities from application code.

Image

RedisGraph Python Client

The 'redisgraph-py' is a package that allows querying Graph data in a Redis database that is extended with the RedisGraph module. The package extends redisgraph-py's interface with RedisGraph's API

Follow the steps below to get started with RedisGraph with Python:

Step 1. Run Redis Stack Docker container

Step 2. Verify if RedisGraph module is loaded

Step 3. Loading the Python Module

Step 4. Write a python code

Step 5. Execute the Python Script

Step 6. Monitor the Graph query

Let us comment out the last line. Try to query Graph data over over RedisInsight.

Step 7. Install RedisInsight

Run the RedisInsight container. The easiest way is to run the following command:

Step 8. Accessing RedisInsight

Next, point your browser to http://localhost:8001.

Step 9. Run the Graph Query

You can use the limit clause to limit the number of records returned by a query:

MATCH (n) RETURN n LIMIT 1

Image

Step 10. Run the Graph Query with no LIMIT

MATCH (n) RETURN n

Image

References

  • Learn more about RedisGraph in the Quickstart tutorial.

Image