Skip to main content

A fast asyncio MySQL driver

Project description

asyncmy - A fast asyncio MySQL driver

image image pypi ci

Introduction

asyncmy is a fast asyncio MySQL driver, which reuse most of pymysql and rewrite core with cython to speedup.

Benchmark

The result comes from benchmark, we can know asyncmy performs well when compared to other drivers.

Install

Just install from pypi:

> pip install asyncmy

Usage

Use connect

from asyncmy import connect
from asyncmy.cursors import DictCursor
import asyncio


async def run():
    conn = await connect()
    async with conn.cursor(cursor=DictCursor) as cursor:
        await cursor.execute("create database if not exists test")
        await cursor.execute(
            """CREATE TABLE if not exists test.asyncmy
    (
        `id`       int primary key auto_increment,
        `decimal`  decimal(10, 2),
        `date`     date,
        `datetime` datetime,
        `float`    float,
        `string`   varchar(200),
        `tinyint`  tinyint
    )"""
        )


if __name__ == '__main__':
    asyncio.run(run())

Use pool

import asyncmy
import asyncio


async def run():
    pool = await asyncmy.create_pool()
    async with pool.acquire() as conn:
        async with conn.cursor() as cursor:
            await cursor.execute("SELECT 1")
            ret = await cursor.fetchone()
            assert ret == (1,)


if __name__ == '__main__':
    asyncio.run(run())

ThanksTo

  • pymysql,a pure python MySQL client.

License

This project is licensed under the Apache-2.0 License.

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

asyncmy-0.1.1.tar.gz (42.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

asyncmy-0.1.1-cp39-cp39-manylinux2014_x86_64.whl (51.1 kB view details)

Uploaded CPython 3.9

File details

Details for the file asyncmy-0.1.1.tar.gz.

File metadata

  • Download URL: asyncmy-0.1.1.tar.gz
  • Upload date:
  • Size: 42.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for asyncmy-0.1.1.tar.gz
Algorithm Hash digest
SHA256 44ce538d78b7c3277b47c7c06659808f8165f091216727adda1ff5f6665270a5
MD5 ba31c7397e67be3821f7db0e54091e29
BLAKE2b-256 f7fbb7bb09192dac56c0a2cec87d4630142a99308ffbe60269040622af1c992b

See more details on using hashes here.

File details

Details for the file asyncmy-0.1.1-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

  • Download URL: asyncmy-0.1.1-cp39-cp39-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 51.1 kB
  • Tags: CPython 3.9
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for asyncmy-0.1.1-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 06064f6b6ccbe2c4e03ee7dca74f3298f8d9098484a9498c328a38cab1aa9132
MD5 db52d4187df3d9c8f237063abbf230f2
BLAKE2b-256 1a27b45a6fd65b5b9a2c5166cb3dbbfa2f5b26c9d83d964962580d91bdef1f03

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page