Skip to content

Releases: Vastxiao/asmysql

v1.0.0

19 Oct 01:23
eca8c91
Compare
Choose a tag to compare

What's Changed

Features

  1. Update the supported Python version range, with a minimum support of 3.9.
  2. Update the documentation content.

Features

  1. 更新Python版本支持范围,最低支持3.9。
  2. 更新文档内容。

v0.2.0

15 Oct 13:20
4bae067
Compare
Choose a tag to compare

What's Changed

Features

  1. Fixed the handling of the echo parameter in aiomysql.
  2. Added the echo_sql_log parameter to the AsMysql class, used to control whether aiomysql outputs the executed SQL statements (default is False).
from asmysql import AsMysql

class TestAsMysql(AsMysql):
    # This allows controlling whether the executed SQL statements in aiomysql
    # are output to Logging.logger.
    echo_sql_log = True


# Of course, the `echo_sql_log` parameter can also be passed when instantiating AsMysql.
async def main():
    async with TestAsMysql(echo_sql_log=True) as mysql:
        result = await mysql.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)

Features

  1. 修复aiomysql对echo参数的处理。
  2. 对AsMysql类新增echo_sql_log参数,用于控制aiomysql是否输出执行的sql语句(默认False)。
from asmysql import AsMysql

class TestAsMysql(AsMysql):
    # 这样就可以控制aiomysql库是否在Logging.logger输出执行的sql语句。
    echo_sql_log = True


# 当然,echo_sql_log参数也可以在实例化AsMysql时传入。
async def main():
    async with TestAsMysql(echo_sql_log=True) as mysql:
        result = await mysql.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)

v0.1.4

13 Oct 08:35
a819860
Compare
Choose a tag to compare

Features

1.AsMysql支持异步上下文管理器。

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:
            async for item in result.iterate():
                print(item)

async def main():
    async with TestAsMysql() as mysql:
        await mysql.get_users()

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