Skip to main content

Tornado asynchronous MySQL Driver [fork of TorMysql]

Project description

mytor

https://travis-ci.org/mosquito/mytor.svg

Tornado asynchronous MySQL Driver.

This if fork of TorMySQL.

About

mytor - presents a Tornado Future-based API and greenlet for non-blocking access to MySQL.

Installation

pip install mytor

Examples

import mytor
from tornado.ioloop import IOLoop
from tornado.gen import coroutine


pool = mytor.ConnectionPool(
    max_connections = 20,       #max open connections
    idle_seconds = 7200,        #conntion idle timeout time, 0 is not timeout
    host = "127.0.0.1",
    user = "root",
    passwd = "secret",
    db = "test",
    charset = "utf8"
)


@coroutine
def test():
    with (yield pool.Connection()) as conn:
        with conn.cursor() as cursor:
            yield cursor.execute("SELECT * FROM test")
            datas = cursor.fetchall()

    print datas
    yield pool.close()

IOLoop.current().run_sync(test)

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

mytor-0.2.7.tar.gz (7.4 kB view hashes)

Uploaded source

Built Distribution

mytor-0.2.7-py2.py3-none-any.whl (10.5 kB view hashes)

Uploaded 2 7

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page