Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Q4M operation wrapper

Project Description

This module is simple Q4M operation wrapper developed by pixiv Inc. for asynchronous upload system

Simple example of usage is followings

>>> from python_q4m.q4m import *
>>> class QueueTable(Q4M):
>>>     def __init__(self, con):
>>>         super(self.__class__, self).__init__(con)
>>>         self.table   = 'queue_table'
>>>         self.columns = ['id',
>>>                         'msg',
>>>                        ]
>>> try:
>>>    con = MySQLdb.connect(host='localhost',
>>>                          db=dbname,
>>>                          user=username,
>>>                          passwd=password,
>>>                         )
>>>    q = QueueTable(con)
>>>    q.enqueue([1, 'msg'])
>>>    while q.wait() == 0:
>>>        time.sleep(1);
>>>     res = q.dequeue()
>>>     print res['id']
>>>     print res['msg']
>>>     q.end()
>>>     con.close()
>>> except MySQLdb.Error, e:
>>>     print 'Error %d: %s' % (e.args[0], e.args[1])
>>>     q.abort()
>>>     con.close()

And it is necessary to create following table for above example.

CREATE TABLE queue_table (id int(11) NOT NULL, msg text NOT NULL) ENGINE=QUEUE;

Release History

Release History

This version
History Node


History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
python_q4m-0.0.6-py2.7.egg (5.2 kB) Copy SHA256 Checksum SHA256 2.7 Egg May 5, 2011
python_q4m-0.0.6.tar.gz (2.3 kB) Copy SHA256 Checksum SHA256 Source May 5, 2011

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting