file 업로드 엔드포인트 추가 (Azure Blob 연동)
This commit is contained in:
1 parent
20fdf53264
commit
18d01357c0
6 files changed
+298
-1
No files matched your search
@@ -70,6 +70,15 @@ 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))
|
||||
|
||||
@@ -90,6 +99,21 @@ async def insert_gangnam_unni_row(hospital_id: str, url: str) -> int:
|
||||
return await execute("INSERT INTO gangnam_unni_data (hospital_id, url) VALUES (%s, %s)", (hospital_id, url))
|
||||
|
||||
|
||||
async def insert_file_row(
|
||||
analysis_run_id: str,
|
||||
file_type: str,
|
||||
file_name: str,
|
||||
file_url: str,
|
||||
size_bytes: int | None = None,
|
||||
hospital_id: str | None = None,
|
||||
) -> int:
|
||||
return await execute(
|
||||
"INSERT INTO file_data (analysis_run_id, hospital_id, file_type, file_name, file_url, size_bytes)"
|
||||
" VALUES (%s, %s, %s, %s, %s, %s)",
|
||||
(analysis_run_id, hospital_id, file_type, file_name, file_url, size_bytes),
|
||||
)
|
||||
|
||||
|
||||
async def insert_analysis_run(
|
||||
analysis_run_id: str,
|
||||
hospital_id: str,
|
||||
|
||||
Reference in new issue
Block a user