File: main.py

package info (click to toggle)
python-asyncmy 0.2.10-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 676 kB
  • sloc: python: 3,528; makefile: 40
file content (24 lines) | stat: -rw-r--r-- 470 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import asyncio
import logging
import os

from asyncmy import connect

logging.basicConfig(level=logging.INFO)


async def main():
    conn = await connect(
        user="root",
        password=os.getenv("MYSQL_PASS", "123456"),
        database="test",
        echo=True,
    )
    async with conn.cursor() as cursor:
        await cursor.execute("select 1")
        ret = await cursor.fetchone()
        print(ret)


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