Skip to main content

sanic-aiomysql

setup

install

pip install git+https://github.com/tuna2134/sanic-aiomysql.git

Use

from sanic import Sanic, response
from sanic_mysql import ExtendMySQL

app = Sanic("app")
ExtendMySQL(app, auto=True, user="root", host=127.0.0.1, password="hello", autocommit=True)

@app.get("/")
async def main(request):
    await request.ctx.cursor.execute("CREATE TABLE data(name TEXT, value BIGINT)")
    return response.text("create a table")
    
app.run()

or

from sanic import Sanic, response
from sanic_mysql import ExtendMySQL

app = Sanic("app")
ExtendMySQL(app, user="root", host=127.0.0.1, password="hello", autocommit=True)

@app.get("/")
async def main(request):
    async with request.ctx.pool.acquire() as conn:
        async with conn.cursor() as cursor:
            await cursor.execute("CREATE TABLE data(name TEXT, value BIGINT)")
    return response.text("create a table")
    
app.run()

or

from sanic import Sanic, response
from sanic_mysql import ExtendMySQL, cursor

app = Sanic("app")
ExtendMySQL(app, user="root", host=127.0.0.1, password="hello", autocommit=True)

@app.get("/")
@cursor()
async def main(request, connection, cursor):
    await cursor.execute("CREATE TABLE data(name TEXT, value BIGINT)")
    return response.text("create a table")
    
app.run()

Metadata

Release files for sanic-aiomysql 2022.4.17

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sanic-aiomysql 2022.4.17
File Size Uploaded Provenance
sanic-aiomysql-2022.4.17.tar.gz 3.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for sanic-aiomysql 2022.4.17
File Interpreter ABI Platform
sanic_aiomysql-2022.4.17-py3-none-any.whl Python 3 none any Details

Total release size: 7.0 kB

Release files / sanic-aiomysql-2022.4.17.tar.gz

Download URL sanic-aiomysql-2022.4.17.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
67514800706fd80584eecbd385a018236ae5f78dddec10e45c9b422bf4bc16d3
BLAKE2b-256 checksum
How to use checksums
bf6a623982fc561004cb27951fb187cddd32270e00d0ff18f4a697188080bb75
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.4

Release files / sanic_aiomysql-2022.4.17-py3-none-any.whl

Download URL sanic_aiomysql-2022.4.17-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
752c9a3d1b740326d5b823ba09c0c5209dcd6d9f85e5fdca16f6ba5dc2bffc6f
BLAKE2b-256 checksum
How to use checksums
ba6d51cc930884ff8aa9dad2a5e10d03893c0719b5bec084ae76a6dc11f63e00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.4

Security for sanic-aiomysql 2022.4.17

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.

Release history Release notifications | RSS feed

This release

2022.4.17 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page