A Redis client library for Twisted Python

Overview

txRedis

Asynchronous Redis client for Twisted Python.

Install

Install via pip. Usage examples can be found in the examples/ directory of this repository.

pip install txredis

Included are two protocol implementations, one using a custom Twisted based protocol parser, and another using the hiredis protocol parser. If you would like to use hiredis, simply install it via pip and use the provided HiRedisClient protocol:

pip install -U hiredis

Bugs

File bug reports and any other feedback with the issue tracker at http://github.com/deldotdr/txRedis/issues/

Contributing

Please open a pull request at http://github.com/deldotdr/txRedis and be sure to include tests.

Contact

There is no a txRedis list but questions can be raised in the issues area or in the Redis community.

Comments
  • ImportError: cannot import name Redis

    ImportError: cannot import name Redis

    When trying to run the examples, all off them fail with:

    Traceback (most recent call last): File "demo.py", line 5, in from txredis.protocol import Redis ImportError: cannot import name Redis

    opened by nbari 2
  • Nested multi bulk 2011 06 18

    Nested multi bulk 2011 06 18

    Accept nested multi-bulk responses. These can be returned from execute() commands where the transaction includes commands that normally return multi-bulk responses.

    opened by jdavisp3 2
  • returning deferreds from subscriber api calls

    returning deferreds from subscriber api calls

    Hello gentlemen!

    I've been playing around with txRedis, very nice work.

    I tried modifying the pubsub example to actually print out the message that was published and found that it didn't work. It seems the message is published before the subscription goes into effect, since the subscribe() api doesn't actually return a deferred that fires when the server responds with the subscription confirmation.

    What do you think about this patch?

    thanks, dave

    opened by jdavisp3 2
  • Implemented DB selection on connect.

    Implemented DB selection on connect.

    * __init__ takes a db parameter that is never
      acted on. 
    * Adds functionality so that DB selection takes
      place after authentication if a DB is selected.
    
    opened by williamsjj 2
  • please update pipy version ..

    please update pipy version ..

    The version in the cheeseshop is one year old, and does not handle zsets for instance .. (and doesn't use multi bulk protocol). so not at all making use of all cool redis 2.0 features ..

    could you please update it ?? (this is just in order to comfortably use pip install txredis .. but using the git is also doable with pip so this is totally not critical )

    opened by flo-dhalluin 2
  • Multithreading

    Multithreading

    When I load my server with ~100 req/sec I see wrong callbacks called in 'self._request_queue.popleft().callback(reply)'. It's a multithreading script. I've spent one week trying to fix it with no success. Any suggestions?

    Update: Ooops, win32com threads was not working as I expected, sorry for wrong issue.

    opened by senyai 2
  • zrangebyscore with scores and emptymultibulk

    zrangebyscore with scores and emptymultibulk

    Hi! I see exception 'object of type 'int' has no len()' when I use zrangebyscore with withscores set to True. Redis returns emptymultibulk which is "*0\r\n" when there is no results and post_process fail. Thank you.

    opened by senyai 2
  • Remove redundant

    Remove redundant "ERR" from ResponseError message

    A tiny patch, but it seems like the original intent was to remove "ERR" from the ResponseError string since this is redundant. Removing ERR in the message is also done in redis-py. The current code is at least peculiar enough to suggest this:

    ResponseError(data if data[:4] == 'ERR ' or data) # ??? of course, always data no matter what

    opened by djfroofy 1
  • Move to new unified request protocol

    Move to new unified request protocol

    Currently in txRedis we use a mix of the old and new protocols. Redis 2.2 has moved to using the new protocol exclusively, so we should move to that accordingly.

    2.0 
    opened by rlotun 1
  • Fixed bug in hget function

    Fixed bug in hget function

    The hget function did not work for single key query.

    Example: redis.hget('table', 'field')

    Expected result: {'field': 'value'}

    Actual result: {'d': 'e', 'e': 'l', 'f': 'v', 'i': 'a', 'l': 'u'}

    opened by ivaxer 1
  • docs: Fix a few typos

    docs: Fix a few typos

    There are small typos in:

    • txredis/client.py
    • txredis/protocol.py

    Fixes:

    • Should read synchronization rather than synchrnonization.
    • Should read replication rather than replicaiton.
    • Should read remove rather than remvoe.
    • Should read references rather than refereces.
    • Should read pattern rather than patern.
    • Should read passed rather than passsed.
    • Should read already rather than arleady.
    • Should read ordered rather than orderd.

    Semi-automated pull request generated by https://github.com/timgates42/meticulous/blob/master/docs/NOTE.md

    opened by timgates42 0
  • Port to Python 3.5

    Port to Python 3.5

    This branch is compatible with both Python 2.7 and Python 3.5.

    I adopt the convention that the Protocol class must accept and emit Unicode strings and is responsible for converting objects to bytes.

    The changes to the tests are mostly small compatibility fixes with a few exceptions:

    • my redis is truncating floats in the sorting test differently than the test suite expects, so I'm skipping the test; I don't know if it's important to test the precision but this feels like something that Redis has changed
    • test_rename_same_src_dest succeeds on my redis install; it looks like renaming to the same name is allowed, now

    I propose deleting the rename_same_src_dest test and adopting less stringent tests for the floating point sort test.

    Thanks!

    opened by tdsmith 1
  • builtins.ImportError: No module named 'exceptions'

    builtins.ImportError: No module named 'exceptions'

    txredis 2.4 installed on python3.4 over easy_install3 after starting crossbar router, this error came up.

    Traceback (most recent call last): File "/usr/local/lib/python3.4/dist-packages/autobahn/wamp/protocol.py", line 842, in onMessage on_reply = txaio.as_future(endpoint.fn, _invoke_args, *_invoke_kwargs) File "/usr/local/lib/python3.4/dist-packages/txaio/tx.py", line 408, in as_future return maybeDeferred(fun, _args, *_kwargs) File "/usr/local/lib/python3.4/dist-packages/twisted/internet/defer.py", line 150, in maybeDeferred result = f(_args, *_kw) File "/usr/local/lib/python3.4/dist-packages/crossbar/worker/router.py", line 643, in start_router_component create_component = _appsession_loader(config) --- --- File "/usr/local/lib/python3.4/dist-packages/crossbar/worker/init.py", line 58, in _appsession_loader module = importlib.import_module(module_name) File "/usr/lib/python3.4/importlib/init.py", line 109, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 2254, in _gcd_import

    File "", line 2237, in _find_and_load

    File "", line 2226, in _find_and_load_unlocked

    File "", line 1200, in _load_unlocked

    File "", line 1129, in _exec

    File "", line 1471, in exec_module

    File "", line 321, in _call_with_frames_removed

    File "/home/www/work/dc/example/crossbar/components/main.py", line 7, in from helpers.util import success File "/home/www/work/dc/example/backend/crossbar/helpers/util.py", line 6, in from txredis.client import RedisClient File "/usr/local/lib/python3.4/dist-packages/txredis-2.4-py3.4.egg/txredis/init.py", line 39, in

    builtins.ImportError: No module named 'exceptions'

    opened by WebDevelopNemanja 1
  • Handle ```ConnectionLost``` errors in ```txredis.client.RedisClient.connectionLost()```

    Handle ```ConnectionLost``` errors in ```txredis.client.RedisClient.connectionLost()```

    There is a problem where, after a txredis.client.RedisClient has successfully sent a QUIT command to the Redis server, the server properly tears down the connection, and Twisted properly calls txredis.client.RedisClient.connectionLost, which calls txredis.RedisClient.failRequests, the later of which propagates the twisted.internet.error.ConnectionLost to all requests in its internal queue (txredis.RedisClient._request_queue), without seemingly bothering to check if these requests have already succeeded. This causes the deferred transactions in the internal queue to assume that their overarching RedisClient has a half-terminated TCP connection, causing thousands of errbacks to get propagated for no good reason.

    Technically, the ConnectionLost is not really an error, it's just a signal sent from Twisted that the other end tore down the connection. This is precisely what is supposed to happen when you send QUIT, so this is somewhat a design flaw in txredis.

    For a piece of software I develop at work, I have fixed this issue by subclassing RedisClient and overriding the connectionLost method as follows:

    class MyRedisClient(txredis.client.RedisClient):
        def connectionLost(self, reason):
            trapped = reason.trap(ConnectionLost)
            if trapped:
                log.msg(
                    ("Trap prevented ConnectionLost from propagating to "
                     "`RedisClient.failRequests()`. All's well."))
            else:
                super(MyRedisClient, self).connectionLost(reason)
    

    If desired, I can gladly either fork or provide git patches, if you think that this issue merits fixing.

    Thanks for creating txredis!

    opened by isislovecruft 0
  • Update client.py

    Update client.py

    for knowing the original subscribing pattern in the message receive none-Pattern subscription the channel is the pattern permit multiple subcription and retreive original subscription

    opened by dynamikdev 0
Owner
Dorian Raymer
Dorian Raymer
Redis client for Python asyncio (PEP 3156)

Redis client for Python asyncio. Redis client for the PEP 3156 Python event loop. This Redis library is a completely asynchronous, non-blocking client

Jonathan Slenders 554 Dec 4, 2022
A tiny python web application based on Flask to set, get, expire, delete keys of Redis database easily with direct link at the browser.

First Redis Python (CRUD) A tiny python web application based on Flask to set, get, expire, delete keys of Redis database easily with direct link at t

Max Base 9 Dec 24, 2022
An asyncio compatible Redis driver, written purely in Python. This is really just a pet-project for me.

asyncredis An asyncio compatible Redis driver. Just a pet-project. Information asyncredis is, like I've said above, just a pet-project for me. I reall

Vish M 1 Dec 25, 2021
asyncio (PEP 3156) Redis support

aioredis asyncio (PEP 3156) Redis client library. Features hiredis parser Yes Pure-python parser Yes Low-level & High-level APIs Yes Connections Pool

aio-libs 2.2k Jan 4, 2023
A fast PostgreSQL Database Client Library for Python/asyncio.

asyncpg -- A fast PostgreSQL Database Client Library for Python/asyncio asyncpg is a database interface library designed specifically for PostgreSQL a

magicstack 5.8k Dec 31, 2022
Google Cloud Client Library for Python

Google Cloud Python Client Python idiomatic clients for Google Cloud Platform services. Stability levels The development status classifier on PyPI ind

Google APIs 4.1k Jan 1, 2023
python-bigquery Apache-2python-bigquery (🥈34 · ⭐ 3.5K · 📈) - Google BigQuery API client library. Apache-2

Python Client for Google BigQuery Querying massive datasets can be time consuming and expensive without the right hardware and infrastructure. Google

Google APIs 550 Jan 1, 2023
Py2neo is a client library and toolkit for working with Neo4j from within Python

Py2neo Py2neo is a client library and toolkit for working with Neo4j from within Python applications. The library supports both Bolt and HTTP and prov

py2neo.org 1.2k Jan 2, 2023
google-cloud-bigtable Apache-2google-cloud-bigtable (🥈31 · ⭐ 3.5K) - Google Cloud Bigtable API client library. Apache-2

Python Client for Google Cloud Bigtable Google Cloud Bigtable is Google's NoSQL Big Data database service. It's the same database that powers many cor

Google APIs 39 Dec 3, 2022
Pure Python MySQL Client

PyMySQL Table of Contents Requirements Installation Documentation Example Resources License This package contains a pure-Python MySQL client library,

PyMySQL 7.2k Jan 9, 2023
Python client for Apache Kafka

Kafka Python client Python client for the Apache Kafka distributed stream processing system. kafka-python is designed to function much like the offici

Dana Powers 5.1k Jan 8, 2023
Asynchronous Python client for InfluxDB

aioinflux Asynchronous Python client for InfluxDB. Built on top of aiohttp and asyncio. Aioinflux is an alternative to the official InfluxDB Python cl

Gustavo Bezerra 159 Dec 27, 2022
Official Python low-level client for Elasticsearch

Python Elasticsearch Client Official low-level client for Elasticsearch. Its goal is to provide common ground for all Elasticsearch-related code in Py

elastic 3.8k Jan 1, 2023
High level Python client for Elasticsearch

Elasticsearch DSL Elasticsearch DSL is a high-level library whose aim is to help with writing and running queries against Elasticsearch. It is built o

elastic 3.6k Jan 3, 2023
Python client for InfluxDB

InfluxDB-Python InfluxDB-Python is a client for interacting with InfluxDB. Development of this library is maintained by: Github ID URL @aviau (https:/

InfluxData 1.6k Dec 24, 2022
Confluent's Kafka Python Client

Confluent's Python Client for Apache KafkaTM confluent-kafka-python provides a high-level Producer, Consumer and AdminClient compatible with all Apach

Confluent Inc. 3.1k Jan 5, 2023
MinIO Client SDK for Python

MinIO Python SDK for Amazon S3 Compatible Cloud Storage MinIO Python SDK is Simple Storage Service (aka S3) client to perform bucket and object operat

High Performance, Kubernetes Native Object Storage 582 Dec 28, 2022
Pysolr — Python Solr client

pysolr pysolr is a lightweight Python client for Apache Solr. It provides an interface that queries the server and returns results based on the query.

Haystack Search 626 Dec 1, 2022
PyRemoteSQL is a python SQL client that allows you to connect to your remote server with phpMyAdmin installed.

PyRemoteSQL Python MySQL remote client Basically this is a python SQL client that allows you to connect to your remote server with phpMyAdmin installe

ProbablyX 3 Nov 4, 2022