Getting Started

The purpose of walrus is to make working with Redis in Python a little easier by wrapping rich objects in Pythonic containers.

Let’s see how this works by using walrus in the Python interactive shell. Make sure you have redis installed and running locally.

Introducing walrus

To begin using walrus, we’ll start by importing it and creating a Database instance. The Database object is a thin wrapper over the redis-py Redis class, so any methods available on Redis will also be available on the walrus Database object.

>>> from walrus import *
>>> db = Database(host='localhost', port=6379, db=0)

If you like fun names, you can also use Walrus instead:

>>> from walrus import *
>>> db = Walrus(host='localhost', port=6379, db=0)