Skip to main content

Wrapper for twisted.enterprise.adbapi.ConnectionPool to use with tornado

Project description

Want to use twisted’s adbapi in tornado but does not know how? Try toradbapi.

This is just wrapper for twisted.enterprise.adbapi.ConnectionPool to use with tornado. So documentation for __init__ args you can find at twisted docs

Available methods in toradbapi.ConnectionPool:

  • run_query
  • run_operation
  • run_interaction

They all have similar interface as twisted’s corresponding methods. They return instance of Future, so can be yielded inside coroutine.

Example usage:

from tornado import gen
from toradbapi import ConnectionPool

pool = ConnectionPool('MySQLdb', db='test')

@gen.coroutine
def get_entities():
    entities = yield pool.run_query('SELECT * FROM `entity`')
    raise gen.Return(entities)

Demo project is under demo.py file. Also there are more examples in tests.py.

Only Python 2.7 supported for now.

Project details


Release history Release notifications

This version
History Node

0.1.3

History Node

0.1.2

History Node

0.1.1

History Node

0.1

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
toradbapi-0.1.3.tar.gz (4.7 kB) Copy SHA256 hash SHA256 Source None Sep 26, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page