Aiomysql-Core
Simple framework for aiomysql
Introduce
simple package, easy to use
Document
Installation
pip install aiomysql-core
Simple uses
import asyncio
import aiomysql
from aiomysql_core import AioMysqlCore
async def test_example(loop):
pool = await aiomysql.create_pool(host='', port=3306,
user='', password='',
db='', loop=loop)
core = AioMysqlCore(pool=pool)
rows = await core.query('select * from users where uid=%s', 113)
print(rows)
rows = await core.gener('select * from users limit 100')
async for row in rows:
print(row)
row = await core.get('select * from users where uid=%(uid)s', {'uid': 113})
print(row)
rowcount = await core.execute_rowcount('select * from users where uid=%(uid)s', {'uid': 113})
print(rowcount)
pool.close()
await pool.wait_closed()
loop = asyncio.get_event_loop()
loop.run_until_complete(test_example(loop))
Simple SQLAlchemy uses
import asyncio
from aiomysql.sa import create_engine
from aiomysql_core import AioMysqlAlchemyCore
from sqlalchemy import Column, Integer, String, MetaData, Table
metadata = MetaData()
Test = Table('test', metadata,
Column('id', Integer, primary_key=True),
Column('content', String(255), server_default="")
)
async def test_example(loop):
config = {'user': '', 'password': '', 'db': '',
'host': '', 'port': 3306, 'autocommit': True, 'charset': 'utf8mb4'}
engine = await create_engine(loop=loop, **config)
core = AioMysqlAlchemyCore(engine=engine)
# insert
doc = {'content': 'insert'}
clause = Test.insert().values(**doc)
rowcount = await core.execute_rowcount(clause)
print(rowcount)
# search
clause = Test.select().where(Test.c.id == 1).limit(1)
row = await core.get(clause)
print(row.id, row.content)
clause = Test.select().where(Test.c.id > 1)
rows = await core.query(clause)
async for row in rows:
print(row.id, row.content)
# update
doc = {'content': 'update'}
clause = Test.update().values(**doc).where(Test.c.id == 1)
rowcount = await core.execute_rowcount(clause)
print(rowcount)
# delete
clause = Test.delete().where(Test.c.id == 1)
rowcount = await core.execute_rowcount(clause)
print(rowcount)
await engine.wait_closed()
loop = asyncio.get_event_loop()
loop.run_until_complete(test_example(loop))
Metadata
Release files for aiomysql-core 0.0.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aiomysql-core-0.0.9.tar.gz | 3.6 kB | Without provenance | Details for aiomysql-core-0.0.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aiomysql_core-0.0.9-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for aiomysql_core-0.0.9-py2.py3-none-any.whl |
Total release size: 8.1 kB
Release files / aiomysql-core-0.0.9.tar.gz
| Download URL | aiomysql-core-0.0.9.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8693a603e467c47dc07c63e17edc790234271255842c6d87fe9e92de8d98f31e
|
|
BLAKE2b-256 checksum How to use checksums |
b83bf01d44e9d2ca76f838d73f8e46c40566542a684ad446af7d000e88619a37
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.2
|
Release files / aiomysql_core-0.0.9-py2.py3-none-any.whl
| Download URL | aiomysql_core-0.0.9-py2.py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
728fc5c43d0679797ea5166408bb2a9a73a1bda434b9890b57955ebb7a3ec77d
|
|
BLAKE2b-256 checksum How to use checksums |
c3ec3ac90a7e22d4ad60fde2dcf6ed2a713fd1a48dc681e3c432df82e089ee63
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.2
|
Security for aiomysql-core 0.0.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.