Skip to main content

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)
```

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)

Uploaded Source

Built Distribution

prestornado-0.1.7-py2-none-any.whl (34.5 kB view hashes)

Uploaded Python 2

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page