I Use This!
Activity Not Available
Analyzed about 2 years ago. based on code collected about 2 years ago.

Project Summary

A pythonic python-only implementation of Tokyo Tyrant protocol. Table extension and query operations are also implementend. Python 2.4+ is needed

This library takes a "pythonic" approach to make it more clear and easy to implement. This code is based on pytyrant

More information about Tokyo Cabinet:


More information about Tokyo Tyrant:


Hash DatabaseUsing hash database is like using dictionaries on python with some extra features. (You can see the docstrings to learn all the features)

>>> import pyrant
>>> t = pyrant.Tyrant(host='', port=1978)
>>> t['key'] = 'foo'
>>> print t['key']
>>> t.concat('key', 'bar')
>>> print t['key']
>>> 'key' in t
>>> del t['key']
>>> print t['key']
Traceback (most recent call last):
KeyError: 'key'Table Databasepyrant supports table records and query operations. To insert a record just use as before but set a dictionary as value.

Table record example

>>> from pyrant import Tyrant, Q
>>> t = Tyrant(host='', port=1978)
>>> t['i'] = {'name': 'Martin Conte Mac Donell', 'gender': 'M', 'age': 26}
>>> t['you'] = {'name': 'Guido', 'gender': 'M', 'age': 33}
>>> print t['i']
{'name': 'Martin Conte Mac Donell', 'gender': 'M'}FilterYou can query elements using lazy filters. Every filter is added using "AND" operator, if you want to "OR" some field, you should use Q object (see below).

Keys that you can use in queries are:

__eq: Equals (default) to expression __lt: Less than expression __le: Less or equal to expression __gt: Greater than expression __ge: Greater or equal to expression Query filter example code

>>> res = t.query.filter(gender='M') # Query is not done yet
>>> res # Here query is performed
[{'i': {'gender': 'M', 'age': '26', 'name': 'Martin Conte Mac Donell'}}, {'you': {'gender': 'M', 'age': '33', 'name': 'Guido'}}]Query example using Q

>>> res = t.query.filter(gender='M') # Query is not done yet
>>> res = res.filter(Q(age=26) | Q(age=33)) # Query is not done yet
>>> print res # Here query is performed
[{'i': {'gender': 'M', 'age': '26', 'name': 'Martin Conte Mac Donell'}}, {'you': {'gender': 'M', 'age': '33', 'name': 'Guido'}}]OrderOrdering elements are another great feature. It is used to define result order.

Name parameter is the column name, also you can prefix "-" to order desc. If "#" is added just before column name, column are ordered as numbers

Examples: order('-name') order('-#ranking') order('name')

Order example code

# You can order using:
>>> res.order('#age') # New query is performed
[{'i': {'gender': 'M', 'age': '26', 'name': 'Martin Conte Mac Donell'}}, {'you': {'gender': 'M', 'age': '33', 'name': 'Guido'}}]
>>> res.order('-#age') # New query is performed
[{'you': {'gender': 'M', 'age': '33', 'name': 'Guido'}}, {'i': {'gender': 'M', 'age': '26', 'name': 'Martin Conte Mac Donell'}}]Limit / OffsetYou can also subscript Query objects to limit or offset your results.

Limit example code

>>> res[1:2]
[{'i': {'gender': 'M', 'age': '26', 'name': 'Martin Conte Mac Donell'}}]


cabinet python pythonic tokyo tokyocabinet tyrant

In a Nutshell, pyrant...

Apache License 2.0

Place Warranty


Private Use

Use Patent Claims

Commercial Use




Hold Liable

Use Trademarks


Include Copyright

State Changes

Include License

Include Notice

These details are provided for information only. No information here is legal advice and should not be used as such.

All Licenses

This Project has No vulnerabilities Reported Against it

Did You Know...

  • ...
    Black Duck offers a free trial so you can discover if there are open source vulnerabilities in your code
  • ...
    you can embed statistics from Open Hub on your site
  • ...
    55% of companies leverage OSS for production infrastructure
  • ...
    anyone with an Open Hub account can update a project's tags


3 Other

30 Day Summary

Apr 9 2016 — May 9 2016

12 Month Summary

May 9 2015 — May 9 2016


1 user rates this project:
Click to add your rating
Review this Project!