...
async def __query(self, *args, **kwargs):
pool = await aiomysql.create_pool(
host=self.__db_host,
port=self.__port,
user=self.__db_login,
password=self.__db_pass,
db=self.__db_name
)
res = None
async with pool.acquire() as conn:
async with conn.cursor() as cur:
await cur.execute(*args, **kwargs)
res = await cur.fetchall()
await conn.commit()
pool.close()
await pool.wait_closed()
return res
...
async def execute(self, *args, **kwargs):
return await self.__query(*args, **kwargs)
...
async def func(self, args...):
...
await db.execute(f'UPDATE table_name SET column_name = {new_data} WHERE user_id = "{self.user_id}"')
...