Skip to content

mysql connector python with non-blocking interface for python 3.3+

License

Notifications You must be signed in to change notification settings

artemmus/mysql_executor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Non-blocking version of mysql-connector-python for asyncio

Main Features

  • Python 3.3+ compatible
  • Inherited from mysql-connector-python
  • Based on asyncio
  • Provides non-blocking access to MySQL

Install

pip install git+https://github.com/artemmus/mysql_executor.git

Usage

import asyncio
from mysql_executor import *


@asyncio.coroutine
def example(**mysql_connect_params):
    pool = AsyncConnectionPool(size=1, **mysql_connect_params)

    with (yield from pool) as cnx:
        yield from cnx.start_transaction()

        cursor = yield from cnx.async_cursor(named_tuple=True)
        yield from cursor.execute('SELECT 1 AS first')

        row = yield from cursor.fetchone()
        assert row.first == 1

        yield from cnx.commit()

    yield from pool.shutdown()

About

mysql connector python with non-blocking interface for python 3.3+

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages