Skip to content

Commit e2b6a80

Browse files
committed
remove the SELECT command completely. use a separate client instance instead.
1 parent 1c3546c commit e2b6a80

File tree

2 files changed

+5
-17
lines changed

2 files changed

+5
-17
lines changed

CHANGES

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,11 @@
2424
belong to and return a connection to it. ConnectionPool also implements
2525
disconnect() to force all connections in the pool to disconnect from
2626
the Redis server.
27-
* redis-py does not treat the SELECT command as special anymore. Previously,
28-
redis-py tried to make sure you didn't shoot yourself in the foot by
29-
SELECTing a different database, then reusing that connection later and
30-
expecting it to be set. In practice, this caused more headaches than it
31-
was worth. So you can use SELECT if you really want to, although it's
32-
highly recommended to instead create a separate client instance and
33-
connection pool for each Redis database you want to talk to.
27+
* redis-py no longer support the SELECT command. You can still connect to
28+
a specific database by specifing it when instantiating a client instance
29+
or by creating a connection pool. If you need to talk to multiplate
30+
databases within your application, you should use a separate client
31+
instance for each database you want to talk to.
3432
* Completely refactored Publish/Subscribe support. The subscribe and listen
3533
commands are no longer available on the redis-py Client class. Instead,
3634
the `pubsub` method returns an instance of the PubSub class which contains

redis/client.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -294,16 +294,6 @@ def save(self):
294294
"""
295295
return self.execute_command('SAVE')
296296

297-
def select(self, db):
298-
"""
299-
Select a differnet Redis database.
300-
301-
WARNING: this could have severe consequences for pooled connections.
302-
It's highly advised to use a separate connection pool and client
303-
instance to work with multiple databases. Use this at your own risk.
304-
"""
305-
return self.execute_command('SELECT', db)
306-
307297
def shutdown(self):
308298
"Shutdown the server"
309299
try:

0 commit comments

Comments
 (0)