Metadata-Version: 2.0
Name: mytor
Version: 0.2.5
Summary: Tornado asynchronous MySQL Driver [fork of TorMysql]
Home-page: https://github.com/mosquito/mytor
Author: ['snower', 'mosquito']
Author-email: ['sujian199@gmail.com', 'me@mosquito.su']
License: MIT
Keywords: tornado,mysql
Platform: UNKNOWN
Requires-Dist: PyMySQL (==0.6.7)
Requires-Dist: greenlet (>=0.4.2)
Requires-Dist: tornado (>=4.1)

mytor
=====

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

Tornado asynchronous MySQL Driver.

This if fork of TorMySQL_.

.. _TorMySQL: https://github.com/snower/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)


