asmysql


Nameasmysql JSON
Version 0.1.2 PyPI version JSON
download
home_pagehttps://github.com/Vastxiao/asmysql
Summary封装aiomysql的异步mysql客户端引擎。
upload_time2023-07-31 12:27:48
maintainer
docs_urlNone
authorvastxiao
requires_python>=3.11,<4.0
licenseMIT
keywords async asyncio mysql aiomysql
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # asmysql

## Introduction

asmysql is a library for using the MySQL asynchronous client, which is a wrapper for aiomysql.

## Features

* Code supports type annotations.
* Very easy to use, simply inherit the AsMysql class for logical development.
* Supports automatic management of the MySQL connection pool and reconnection mechanism.
* Automatically captures and handles MysqlError errors globally.
* Separates statement execution from data retrieval.

## Install

```sh
# Python3.11+
pip install asmysql
```

## Documentation

### Quick Start

```python
import asyncio
from asmysql import AsMysql


class TestAsMysql(AsMysql):
    host = '127.0.0.1'
    port = 3306
    user = 'root'
    password = 'pass'

    async def get_users(self):
        result = await self.client.execute('select user,authentication_string,host from mysql.user')
        if result.err:
            print(result.err)
        else:
            async for item in result.iterate():
                print(item)

                
async def main():
    mysql = await TestAsMysql()
    await mysql.get_users()


asyncio.run(main())
```

### More Usage

```python
import asyncio
from asmysql import AsMysql

class TestAsMysql(AsMysql):
    async def get_users(self):
        result = await self.client.execute('select user,authentication_string,host from mysql.user')
        if result.err:
            print(result.err)
        else:
            return await result.fetch_all()

mysql = TestAsMysql(host='192.168.1.192', port=3306)

async def main():
    await mysql.connect()  # or: await mysql
    print(await mysql.get_users())

asyncio.run(main())
```
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Vastxiao/asmysql",
    "name": "asmysql",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.11,<4.0",
    "maintainer_email": "",
    "keywords": "async,asyncio,mysql,aiomysql",
    "author": "vastxiao",
    "author_email": "vastxiao@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/5f/5e/0805668446de208ec8934dbc0e239fa6093e240e09371cda0fd4d55358a9/asmysql-0.1.2.tar.gz",
    "platform": null,
    "description": "# asmysql\n\n## Introduction\n\nasmysql is a library for using the MySQL asynchronous client, which is a wrapper for aiomysql.\n\n## Features\n\n* Code supports type annotations.\n* Very easy to use, simply inherit the AsMysql class for logical development.\n* Supports automatic management of the MySQL connection pool and reconnection mechanism.\n* Automatically captures and handles MysqlError errors globally.\n* Separates statement execution from data retrieval.\n\n## Install\n\n```sh\n# Python3.11+\npip install asmysql\n```\n\n## Documentation\n\n### Quick Start\n\n```python\nimport asyncio\nfrom asmysql import AsMysql\n\n\nclass TestAsMysql(AsMysql):\n    host = '127.0.0.1'\n    port = 3306\n    user = 'root'\n    password = 'pass'\n\n    async def get_users(self):\n        result = await self.client.execute('select user,authentication_string,host from mysql.user')\n        if result.err:\n            print(result.err)\n        else:\n            async for item in result.iterate():\n                print(item)\n\n                \nasync def main():\n    mysql = await TestAsMysql()\n    await mysql.get_users()\n\n\nasyncio.run(main())\n```\n\n### More Usage\n\n```python\nimport asyncio\nfrom asmysql import AsMysql\n\nclass TestAsMysql(AsMysql):\n    async def get_users(self):\n        result = await self.client.execute('select user,authentication_string,host from mysql.user')\n        if result.err:\n            print(result.err)\n        else:\n            return await result.fetch_all()\n\nmysql = TestAsMysql(host='192.168.1.192', port=3306)\n\nasync def main():\n    await mysql.connect()  # or: await mysql\n    print(await mysql.get_users())\n\nasyncio.run(main())\n```",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "\u5c01\u88c5aiomysql\u7684\u5f02\u6b65mysql\u5ba2\u6237\u7aef\u5f15\u64ce\u3002",
    "version": "0.1.2",
    "project_urls": {
        "Documentation": "https://github.com/Vastxiao/asmysql/blob/main/README.md",
        "Homepage": "https://github.com/Vastxiao/asmysql",
        "Repository": "https://github.com/Vastxiao/asmysql",
        "asmysql changelog": "https://github.com/Vastxiao/asmysql/blob/main/CHANGELOG.md",
        "asmysql readme-zh": "https://github.com/Vastxiao/asmysql/blob/main/README_zh.md",
        "vastxiao blog": "https://vastxiao.github.io/"
    },
    "split_keywords": [
        "async",
        "asyncio",
        "mysql",
        "aiomysql"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "52829c566739a730e7e02c01d2a73828a643b06c136bda86472e208abcd29166",
                "md5": "587325b2c0b4acdc6a9efe8aca7b8e88",
                "sha256": "9cb90bbd8753567ff5c042dc6d33b8350a06b577eba40c77428ea4b3bd72a1b0"
            },
            "downloads": -1,
            "filename": "asmysql-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "587325b2c0b4acdc6a9efe8aca7b8e88",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11,<4.0",
            "size": 7139,
            "upload_time": "2023-07-31T12:27:46",
            "upload_time_iso_8601": "2023-07-31T12:27:46.906178Z",
            "url": "https://files.pythonhosted.org/packages/52/82/9c566739a730e7e02c01d2a73828a643b06c136bda86472e208abcd29166/asmysql-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5f5e0805668446de208ec8934dbc0e239fa6093e240e09371cda0fd4d55358a9",
                "md5": "a6befaa50eb61d55371c2499e211836a",
                "sha256": "48fec9da7d942790d38372dbb06069b7d4a481c5af117b0437055ec099274d0f"
            },
            "downloads": -1,
            "filename": "asmysql-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "a6befaa50eb61d55371c2499e211836a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11,<4.0",
            "size": 5234,
            "upload_time": "2023-07-31T12:27:48",
            "upload_time_iso_8601": "2023-07-31T12:27:48.655484Z",
            "url": "https://files.pythonhosted.org/packages/5f/5e/0805668446de208ec8934dbc0e239fa6093e240e09371cda0fd4d55358a9/asmysql-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-31 12:27:48",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Vastxiao",
    "github_project": "asmysql",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "asmysql"
}
        
Elapsed time: 0.20499s