Asynchronous PrestoDB DB-API for Tornado Web Server
Project description
# Prestornado
Asynchronous [PrestoDB](https://prestodb.io/) DB-API for [Tornado Web Server](http://tornadoweb.org/)
This is a port based on dropbox's [PyHive](https://github.com/dropbox/PyHive) with `requests` been replaced with tornado's `AsyncHTTPClient`
# Caveat
* Optional PEP-0249 API `next()` has not been implemented yet :(
# Example
```python
from tornado.gen import coroutine
from prestornado import presto
import tornado.ioloop
@coroutine
def run_once():
cursor = presto.connect('prestodb').cursor()
yield cursor.execute('SELECT 1 + 1')
while True:
ret = yield cursor.poll()
if not ret:
break
print ret['stats']['state']
ret = yield cursor.fetchall()
print 'RESULT:', ret
io_loop = tornado.ioloop.IOLoop.instance()
io_loop.run_sync(run_once)
```
Asynchronous [PrestoDB](https://prestodb.io/) DB-API for [Tornado Web Server](http://tornadoweb.org/)
This is a port based on dropbox's [PyHive](https://github.com/dropbox/PyHive) with `requests` been replaced with tornado's `AsyncHTTPClient`
# Caveat
* Optional PEP-0249 API `next()` has not been implemented yet :(
# Example
```python
from tornado.gen import coroutine
from prestornado import presto
import tornado.ioloop
@coroutine
def run_once():
cursor = presto.connect('prestodb').cursor()
yield cursor.execute('SELECT 1 + 1')
while True:
ret = yield cursor.poll()
if not ret:
break
print ret['stats']['state']
ret = yield cursor.fetchall()
print 'RESULT:', ret
io_loop = tornado.ioloop.IOLoop.instance()
io_loop.run_sync(run_once)
```
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
prestornado-0.1.7.tar.gz
(10.3 kB
view hashes)
Built Distribution
Close
Hashes for prestornado-0.1.7-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44196f6ef6c32de2b4f762fe569eba48df80a008d0aa923c1c89e956ef6d0151 |
|
MD5 | 78f4abe874a9ac0dd5758e372bea0dcc |
|
BLAKE2b-256 | de39cfad50a39bcd1428f499f73138544b22ef4e3c59a282da99772d20e738c3 |