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;
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
python_q4m-0.0.6.tar.gz
(2.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
python_q4m-0.0.6-py2.7.egg
(5.2 kB
view details)
File details
Details for the file python_q4m-0.0.6.tar.gz.
File metadata
- Download URL: python_q4m-0.0.6.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a852f1f368dc3e48ebd1849301cfc7cb25b3307e31b058f97a2be598ea9ab90a
|
|
| MD5 |
5662438655e720105bd16d249246882b
|
|
| BLAKE2b-256 |
b80940d27040fc02e51515b810072e34d888d367f5681f219dc94bfbba05a95a
|
File details
Details for the file python_q4m-0.0.6-py2.7.egg.
File metadata
- Download URL: python_q4m-0.0.6-py2.7.egg
- Upload date:
- Size: 5.2 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6090603cc88c135e34ad7dee7853b33c602e198d7798d97f5183c97b689c5187
|
|
| MD5 |
b63d33d68c0010f39864113884b4c366
|
|
| BLAKE2b-256 |
39d8257741665c6cb96b5335fa15a7955e3c7cca07622e95c76d48ab08de6bc2
|