Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve migration user-friendliness #17

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@ b'bar'

The above code connects to localhost on port 6379, sets a value in Redis, and retrieves it. All responses are returned as bytes in Python, to receive decoded strings, set *decode_responses=True*. For this, and more connection options, see [these examples](https://valkey-py.readthedocs.io/en/stable/examples.html).

### Migration from redis-py

You are encouraged to use the new class names, but to allow for a smooth transition alias are available:

``` python
>>> import valkey as redis
>>> r = redis.Redis(host='localhost', port=6379, db=0)
>>> r.set('foo', 'bar')
True
>>> r.get('foo')
b'bar'
```

#### RESP3 Support
To enable support for RESP3 change your connection object to include *protocol=3*
Expand Down
25 changes: 18 additions & 7 deletions valkey/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ def int_or_str(value):
except AttributeError:
VERSION = tuple([99, 99, 99])


Redis = Valkey
StrictRedis = StrictValkey
RedisCluster = ValkeyCluster
RedisError = ValkeyError


__all__ = [
"AuthenticationError",
"AuthenticationWrongNumberOfArgsError",
Expand All @@ -71,24 +78,28 @@ def int_or_str(value):
"ConnectionPool",
"CredentialProvider",
"DataError",
"from_url",
"default_backoff",
"InvalidResponse",
"OutOfMemoryError",
"PubSubError",
"ReadOnlyError",
"Valkey",
"ValkeyCluster",
"ValkeyError",
"Redis",
"RedisCluster",
"RedisError",
"ResponseError",
"SSLConnection",
"Sentinel",
"SentinelConnectionPool",
"SentinelManagedConnection",
"SentinelManagedSSLConnection",
"SSLConnection",
"UsernamePasswordCredentialProvider",
"StrictRedis",
"StrictValkey",
"TimeoutError",
"UnixDomainSocketConnection",
"UsernamePasswordCredentialProvider",
"Valkey",
"ValkeyCluster",
"ValkeyError",
"WatchError",
"default_backoff",
"from_url",
]
Loading