All Projects → snower → Tormysql

snower / Tormysql

Licence: mit
The highest performance asynchronous MySQL driver by PyMySQL

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Tormysql

Aiomysql
aiomysql is a library for accessing a MySQL database from the asyncio
Stars: ✭ 1,252 (+314.57%)
Mutual labels:  asyncio, mysql, mariadb
Doudizhu
html5 斗地主游戏
Stars: ✭ 323 (+6.95%)
Mutual labels:  asyncio, mysql, tornado
Tortoise Orm
Familiar asyncio ORM for python, built with relations in mind
Stars: ✭ 2,558 (+747.02%)
Mutual labels:  asyncio, mysql
Databases
Async database support for Python. 🗄
Stars: ✭ 2,602 (+761.59%)
Mutual labels:  asyncio, mysql
memoize
Caching library for asynchronous Python applications.
Stars: ✭ 53 (-82.45%)
Mutual labels:  tornado, asyncio
Rocketgram
Modern and powerful asynchronous telegram bot framework.
Stars: ✭ 37 (-87.75%)
Mutual labels:  asyncio, tornado
Tornado Sqlalchemy
SQLAlchemy support for Tornado
Stars: ✭ 112 (-62.91%)
Mutual labels:  asyncio, tornado
Arsenic
Async WebDriver implementation for asyncio and asyncio-compatible frameworks
Stars: ✭ 209 (-30.79%)
Mutual labels:  asyncio, tornado
Bitnami Docker Mariadb
Bitnami MariaDB Docker Image
Stars: ✭ 251 (-16.89%)
Mutual labels:  mysql, mariadb
Web Main
🎉 Ultimate Emoji Generator
Stars: ✭ 261 (-13.58%)
Mutual labels:  asyncio, mysql
Sequel Ace
MySQL/MariaDB database management for macOS
Stars: ✭ 3,989 (+1220.86%)
Mutual labels:  mysql, mariadb
Neard
🎲 Portable WAMP software stack
Stars: ✭ 296 (-1.99%)
Mutual labels:  mysql, mariadb
Peewee Async
Asynchronous interface for peewee ORM powered by asyncio
Stars: ✭ 607 (+100.99%)
Mutual labels:  asyncio, mysql
Tornado Celery
Non-blocking Celery client for Tornado
Stars: ✭ 561 (+85.76%)
Mutual labels:  asyncio, tornado
E107
e107 Bootstrap CMS (Content Management System) v2 with PHP, MySQL, HTML5, jQuery and Twitter Bootstrap. Issue Discussion Room: https://gitter.im/e107inc/e107
Stars: ✭ 272 (-9.93%)
Mutual labels:  mysql, mariadb
Aioodbc
aioodbc - is a library for accessing a ODBC databases from the asyncio
Stars: ✭ 206 (-31.79%)
Mutual labels:  asyncio, mysql
Heidisql
A lightweight client for managing MariaDB, MySQL, SQL Server, PostgreSQL and SQLite, written in Delphi
Stars: ✭ 2,864 (+848.34%)
Mutual labels:  mysql, mariadb
Liquibase
Main Liquibase Source
Stars: ✭ 2,910 (+863.58%)
Mutual labels:  mysql, mariadb
Webinoly
Optimized LEMP Web Server to manage your WordPress, PHP, or simple HTML sites running on a powerful NGINX setup.
Stars: ✭ 254 (-15.89%)
Mutual labels:  mysql, mariadb
Lnmp
Support: Nginx 1.12/1.13 + MySQL 5.5/5.6/5.7/8.0(MariaDB 5.5/10.0/10.1/10.2/10.3) + PHP 5.4/5.5/5.6/7.0/7.1/7.2 + phpMyAdmin(Adminer)
Stars: ✭ 262 (-13.25%)
Mutual labels:  mysql, mariadb

TorMySQL

Build Status

The highest performance asynchronous MySQL driver.

PyPI page: https://pypi.python.org/pypi/tormysql

About

Presents a Future-based API and greenlet for non-blocking access to MySQL.

Support both tornado and asyncio.

Installation

pip install TorMySQL

Used Tornado

example pool

from tornado.ioloop import IOLoop
from tornado import gen
import tormysql

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

@gen.coroutine
def test():
    with (yield pool.Connection()) as conn:
        try:
            with conn.cursor() as cursor:
                yield cursor.execute("INSERT INTO test(id) VALUES(1)")
        except:
            yield conn.rollback()
        else:
            yield conn.commit()

        with conn.cursor() as cursor:
            yield cursor.execute("SELECT * FROM test")
            datas = cursor.fetchall()

    print datas
    
    yield pool.close()

ioloop = IOLoop.instance()
ioloop.run_sync(test)

example helpers

from tornado.ioloop import IOLoop
from tornado import gen
import tormysql

pool = tormysql.helpers.ConnectionPool(
    max_connections = 20, #max open connections
    idle_seconds = 7200, #conntion idle timeout time, 0 is not timeout
    wait_connection_timeout = 3, #wait connection timeout
    host = "127.0.0.1",
    user = "root",
    passwd = "TEST",
    db = "test",
    charset = "utf8"
)

@gen.coroutine
def test():
    tx = yield pool.begin()
    try:
        yield tx.execute("INSERT INTO test(id) VALUES(1)")
    except:
        yield tx.rollback()
    else:
        yield tx.commit()

    cursor = yield pool.execute("SELECT * FROM test")
    datas = cursor.fetchall()

    print datas

    yield pool.close()

ioloop = IOLoop.instance()
ioloop.run_sync(test)

Used asyncio alone

example pool

from asyncio import events
import tormysql

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

async def test():
   async with await pool.Connection() as conn:
       try:
           async with conn.cursor() as cursor:
               await cursor.execute("INSERT INTO test(id) VALUES(1)")
       except:
           await conn.rollback()
       else:
           await conn.commit()

       async with conn.cursor() as cursor:
           await cursor.execute("SELECT * FROM test")
           datas = cursor.fetchall()

   print(datas)

   await pool.close()

ioloop = events.get_event_loop()
ioloop.run_until_complete(test)

example helpers

from asyncio import events
import tormysql

pool = tormysql.helpers.ConnectionPool(
   max_connections = 20, #max open connections
   idle_seconds = 7200, #conntion idle timeout time, 0 is not timeout
   wait_connection_timeout = 3, #wait connection timeout
   host = "127.0.0.1",
   user = "root",
   passwd = "TEST",
   db = "test",
   charset = "utf8"
)

async def test():
   async with await pool.begin() as tx:
       await tx.execute("INSERT INTO test(id) VALUES(1)")

   cursor = await pool.execute("SELECT * FROM test")
   datas = cursor.fetchall()

   print(datas)

   await pool.close()

ioloop = events.get_event_loop()
ioloop.run_until_complete(test)

Resources

You can read PyMySQL Documentation online for more information.

License

TorMySQL uses the MIT license, see LICENSE file for the details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].