Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
asmysql is a library for using the MySQL asynchronous client, which is a wrapper for aiomysql.
# Python3.11+
pip install asmysql
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()
await mysql.disconnect()
asyncio.run(main())
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())
await mysql.disconnect()
asyncio.run(main())
FAQs
封装aiomysql的异步mysql客户端引擎。
We found that asmysql demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.