Asynchronous wrapper for MariaDB library (mariadb-connector-python) written in python.
Important
This library is still under early development. For any bugs, please create an issue here.
import aiomaria, asyncio
credentials = {
"host": "localhost",
"port": 3306,
"user": "user",
"password": "password",
"database": "database"
}
async def main() -> None:
con: aiomaria.Connection = await aiomaria.connect(**credentials)
print(con.server_info)
await con.close()
asyncio.run(main())# `pool_name` param will trigger pool creation
pool: aiomaria.Connection = await aiomaria.connect(**credentials, pool_name="test")Note
.connect() will always return aiomaria.Connection. Pool can be accessed from the aiomaria._CONNECTION_POOLS dictionary with its name.
async with aiomaria.Connection(**credentials) as con:
print(con.server_info)
# or
async with aiomaria.ConnectionPool(**credentials, pool_name="test") as pool:
con: aiomaria.Connection = await pool.get_connection()
print(con.server_info)Caution
Due to how wrapper works, mariadb library will no longer work once the aiomaria is imported. This is due to monkeypatching at runtime and will hopefully be resolved in the future.
pip install aiomariaFor operating systems other than MS Windows, some binaries are required. See MariaDB connector installation.
MIT License