patch report
This commit is contained in:
1 parent
e8406dc0ee
commit
b921a0803e
2 files changed
+1
-22
No files matched your search
@@ -26,12 +26,6 @@ async def get_pool() -> aiomysql.Pool:
|
||||
# 쓰기 (INSERT/UPDATE/DELETE)
|
||||
async def execute(sql: str, args: tuple = ()) -> int:
|
||||
pool = await get_pool()
|
||||
print(
|
||||
f"[Pool] size={pool.size} "
|
||||
f"free={pool.freesize} "
|
||||
f"used={pool.size - pool.freesize} "
|
||||
f"max={pool.maxsize}"
|
||||
)
|
||||
async with pool.acquire() as conn:
|
||||
try:
|
||||
async with conn.cursor() as cur:
|
||||
@@ -45,12 +39,6 @@ async def execute(sql: str, args: tuple = ()) -> int:
|
||||
# 읽기 (SELECT)
|
||||
async def fetchone(sql: str, args: tuple = ()) -> dict | None:
|
||||
pool = await get_pool()
|
||||
print(
|
||||
f"[Pool] size={pool.size} "
|
||||
f"free={pool.freesize} "
|
||||
f"used={pool.size - pool.freesize} "
|
||||
f"max={pool.maxsize}"
|
||||
)
|
||||
async with pool.acquire() as conn:
|
||||
try:
|
||||
async with conn.cursor(aiomysql.DictCursor) as cur:
|
||||
@@ -70,15 +58,6 @@ async def fetchall(sql: str, args: tuple = ()) -> list[dict]:
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
|
||||
async def fetchall(sql: str, args: tuple = ()) -> list[dict]:
|
||||
pool = await get_pool()
|
||||
async with pool.acquire() as conn:
|
||||
await conn.ping(reconnect=True)
|
||||
async with conn.cursor(aiomysql.DictCursor) as cur:
|
||||
await cur.execute(sql, args)
|
||||
return list(await cur.fetchall())
|
||||
|
||||
async def insert_instagram_row(hospital_id: str, url: str) -> int:
|
||||
return await execute("INSERT INTO instagram_data (hospital_id, url) VALUES (%s, %s)", (hospital_id, url))
|
||||
|
||||
|
||||
Reference in new issue
Block a user