Python Groonga Client
Python Makefile
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples strict pep8 and pyflakes May 15, 2014
poyonga bump version Jun 20, 2018
test define groonga status Oct 26, 2016
.gitignore update ignore file Feb 23, 2012
.travis.yml support py36 Jun 20, 2018
LICENSE update project info Dec 21, 2013
MANIFEST.in add MANIFEST Feb 21, 2012
Makefile add switch for unittest and static code analyze Apr 23, 2014
README.rst rename to prefix_path from db Oct 27, 2015
THANKS thanks Apr 21, 2014
setup.py version 0.2 Apr 23, 2014
tox.ini add pypy env Apr 21, 2014

README.rst

poyonga

Build status

Python Groonga Client. poyonga support to HTTP and GQTP protocol.

Installation

from pip:

pip install --upgrade poyonga

from easy_install:

easy_install -ZU poyonga

Usage

Setup Groonga Server

$ groonga -n grn.db     # create groonga database file
$ groonga -s grn.db     # start groonga server with GQTP

Basic Usage

>>> from poyonga import Groonga
>>> g = Groonga()
>>> g.protocol
'http'
>>> ret = g.call("status")
>>> ret
<poyonga.result.GroongaResult object at 0x8505ccc>
>>> ret.status
0
>>> ret.body
{u'uptime': 427, u'max_command_version': 2, u'n_queries': 3,
u'cache_hit_rate': 66.6666666666667, u'version': u'1.2.8', u
'alloc_count': 156, u'command_version': 1, u'starttime': 132
8286909, u'default_command_version': 1}
>>>

with eventlet

from poyonga import Groonga
import eventlet

eventlet.monkey_patch()

def fetch(cmd, **kwargs):
    g = Groonga()
    ret = g.call(cmd, **kwargs)
    print ret.status
    print ret.body
    print "*" * 40

cmds = [("status", {}),
        ("log_level", {"level": "warning"}),
        ("table_list", {})
        ("select", {"table": "Site"})]
pool = eventlet.GreenPool()
for cmd, kwargs in cmds:
    pool.spawn_n(fetch, cmd, **kwargs)
pool.waitall()

Custom prefix path

If you use the Custom prefix path and Multi databases , specify prefix_path .

# default is '/d/'
g = Groonga(prefix_path='/db2/')

example code

see examples directory

Links